#define a(x) (x>0?x:-(x))
#define f(x,y) y>a(x-.5)?x--:-y>a(x+.5)?x++:x>a(y+.5)?y++:x|y?y--:x;

#include <iostream>
void test(int x, int y, int rx, int ry){
	std::cout << "(" << x << ", " << y << ")=>";
	f(x,y);
	std::cout << "(" << x << ", " << y << ") - " << ((x==rx&&y==ry)?"OK":"FAILURE") << std::endl;
}

int main() {
	test(0, 0, 0, 0);
	test(1, 0, 1, 1);
	test(1, 1, 0, 1);
	test(0, 1, -1, 1);
	test(-1, 1, -1, 0);
	test(-1, 0, -1, -1);
	test(-1, -1, 0, -1);
	test(0, -1, 1, -1);
	test(1, -1, 1, 0);
	test(95, -12, 95, -11);
	test(127, 127, 126, 127);
	test(-2, 101, -3, 101);
	test(-65, 65, -65, 64);
	test(-127, 42, -127, 41);
	test(-9, -9, -8, -9);
	test(126, -127, 127, -127);
	test(105, -105, 105, -104);
	
	return 0;
}