import java.util.*; import java.lang.String; public class No446{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); String a=sc.nextLine(); String b=sc.nextLine(); if(check(a)==true&&check(b)==true){ System.out.println("OK"); }else{ System.out.println("NG"); } } private static boolean check(String S){ if(S.length()<0||S.length()>5){return false;} if(S.matches("^[0-9]+$")==false){return false;} int n=Integer.parseInt(S); if(n<0||12345