import java.util.*;
import java.io.*;
/**
 * Write a description of class Problem1 here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Pro5
{
    


    
    
    public static void main (String args[]) throws IOException
    {
        Scanner kb = new Scanner( new File("DATA5.txt"));
        PrintWriter xyz = new PrintWriter (new BufferedWriter (new FileWriter("OUT5.txt")));
        for (int x=0;x<5;x++)
        {
           
            
            int number = kb.nextInt();
            int claps = kb.nextInt();
            int [] all = new int[number];
            for (int y=0;y<number;y++)
            all[y]=0;
            
            int constant=(int)Math.pow(2,number);
            while(claps>constant)
            {claps-=constant;}
            //System.out.println(claps);
            
            
           
            if(claps==(int)Math.pow(2,number)-1)
            xyz.println("ON");
            else
            xyz.println("OFF");
            
          
            
        }
        
        xyz.close();
    }    
    
}

