import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); String b = sc.next(); String ans = "OK"; if((a.charAt(0) == '0') && (a.length() > 1)) ans = "NG"; if((b.charAt(0) == '0') && (b.length() > 1)) ans = "NG"; try { for(int i = 0; i < a.length(); i++) { int d = Integer.parseInt(String.valueOf(a.charAt(i))); } for(int i = 0; i < b.length(); i++) { int d = Integer.parseInt(String.valueOf(b.charAt(i))); } } catch(NumberFormatException e) { ans = "NG"; } System.out.println(ans); } }