package yukicoder; import java.util.Scanner; public class Q446 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean correct = true; for (int t = 0; t < 2; ++t) { String s = sc.next(); { assert s.length() >= 1 && s.length() <= 5; for (int i = 0; i < s.length(); ++i) { boolean f = false; if (0 <= s.charAt(i) - 'a' && s.charAt(i) - 'a' <= 'z' - 'a') { f = true; } if (0 <= s.charAt(i) - 'A' && s.charAt(i) - 'A' <= 'Z' - 'A') { f = true; } if (0 <= s.charAt(i) - '0' && s.charAt(i) - '0' <= 9) { f = true; } assert f; } } boolean ok = false; for (int i = 0; i <= 12345; ++i) { if (String.valueOf(i).equals(s)) { ok = true; } } correct &= ok; } if (correct) { System.out.println("OK"); } else { System.out.println("NG"); } sc.close(); } }