import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String a = sc.next(); String b = sc.next(); if (judge(a)==true && judge(b)==true) {System.out.println("OK");} else {System.out.println("NG");} } static boolean judge (String s) { boolean b = false; for (int i=0; i<=12345; i++) { if (s.equals(String.valueOf(i))) {b = true;} } return b; } }