def c():x=input();y=int(x);return (x==str(y))*(y<12346) def f(): try:return c()*c() except:0 print('NOGK'[f()::2])