#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>

using namespace std;
struct snap
{
    bool on;
    bool pow;
};
snap s[30];
int main()
{
    freopen("DATA5.txt", "r", stdin);
    freopen("OUT5.txt", "w", stdout);
    for (int z = 0; z < 5; z++)
    {
        int  n;
        cin >> n;
        int k;
        cin >> k;
        bool works = true;
        for(int i = 0; i < n; i++)
        {
            int t = k;
            if((t >> i)&1);
            else works = false;
        }
        if (works)
        {
            cout << "ON" << endl;
        }
        else
        {
            cout << "OFF" << endl;
        }
    }
    return 0;
}

