#include long long int k, powk; long long int min (long long int a, long long int b){ if (a < b) return a; return b; } long long int clockdist (long long int x, long long int y){ return (y - x + powk) % powk; } int A(long long int x, long long int y){ int distance = 0; x--; y--; while (x != y){ long long int bestdistleft = (1 << 30); long long int bestchoice = -1; //printf ("%lld %lld\n", x+1, y+1); for (int i = 0; i < k; i++){ long long int xp; xp = (x + (1 << i)) % powk; long long int distleft = clockdist (xp, y); //printf ("%lld %lld (%lld %lld)\n", xp+1, y+1, distleft, bestdistleft); if (distleft < bestdistleft){ bestdistleft = distleft; bestchoice = xp; } } x = bestchoice; distance++; } return distance; } int B(long long int x, long long int y){ int distance = 0; x--; y--; while (x != y){ long long int bestdistleft = (1 << 30); long long int bestchoice = -1; //printf ("%lld %lld\n", x+1, y+1); for (int i = 0; i < k; i++){ long long int xp; xp = (x + powk - (1 << i)) % powk; long long int distleft = clockdist (y, xp); //printf ("%lld %lld (%lld %lld)\n", xp+1, y+1, distleft, bestdistleft); if (distleft < bestdistleft){ bestdistleft = distleft; bestchoice = xp; } } x = bestchoice; distance++; } return distance; } int C(long long int x, long long int y){ int distance = 0; x--; y--; while (x != y){ long long int bestdistleft = (1 << 30); long long int bestchoice = -1; //printf ("%lld %lld\n", x+1, y+1); for (int i = 0; i < k; i++){ long long int xp; xp = (x + (1 << i)) % powk; long long int distleft = min (clockdist (xp, y), clockdist (y, xp)); //printf ("%lld %lld (%lld %lld)\n", xp+1, y+1, distleft, bestdistleft); if (distleft < bestdistleft){ bestdistleft = distleft; bestchoice = xp; } } //printf ("%lld %lld\n", x+1, y+1); for (int i = 0; i < k; i++){ long long int xp; xp = (x + powk - (1 << i)) % powk; long long int distleft = min (clockdist (xp, y), clockdist (y, xp)); //printf ("%lld %lld (%lld %lld)\n", xp+1, y+1, distleft, bestdistleft); if (distleft < bestdistleft){ bestdistleft = distleft; bestchoice = xp; } } x = bestchoice; distance++; } return distance; } int main (){ long long int x, y; while (true){ if (scanf ("%lld%lld%lld", &k, &x, &y) != 3) break; powk = (1 << k); printf ("%d %d %d\n", A(x,y), B(x,y), C(x,y)); } }