#!/usr/bin/perl

# Symbol       What happened
# 1            WindowSwitch
# 2            Normal keypress
# 3            Special keypress
# 4-28         Move

while(<>){
    split;
    $tick++;
    $type = $_[0];
    if($type eq "WindowSwitch"){
	print "1\n";
    }
    elsif($type eq "Key"){
	print "2\n";
    }
    elsif($type eq "SpecialKey"){
	print "3\n";
    }
    elsif($type eq "Loc"){
	if(($lkey + 1) == $tick){
	$x = $_[1];
	$y = $_[2];
	$xt = 1+int($x/230);
	$yt = 1+int($y/200);
	$s = 3+$xt+($yt*4);
	print "$lm\n$s\n";
	}
	$lkey = $tick;
	$x = $_[1];
	$y = $_[2];
	$xt = 1+int($x/230);
	$yt = 1+int($y/200);
	$s = 3+$xt+($yt*4);
	$lm = "$s";
    }
}
