import java.util.Scanner; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); String cs0 = sc.nextLine(); String cs1 = sc.nextLine(); try { int a = Integer.parseInt(cs0); int b = Integer.parseInt(cs1); if (a <= 12345 && b <= 12345 && a >= 0 && b >= 0 && Integer.toString(a).length() <= 5 && Integer.toString(b).length() <= 5) { System.out.println("OK"); }else{ System.out.println("NG"); } } catch (NumberFormatException e) { System.out.println("NG"); } } }