import static java.lang.System.*; import java.util.Scanner; public class No446{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); String A=sc.nextLine(); String B=sc.nextLine(); try{ int a=Integer.parseInt(A); int b=Integer.parseInt(B); if(check(a)==1&&check(b)==1){ out.println("OK"); }else{ out.println("NG"); } }catch(Exception e){ out.println("NG"); } } private static int check(int i){ if(0<=i&&i<=12345){return 1;} else{return 0;} } }