a=gets.to_i;b=$_.chop==a.to_s c=gets.to_i;d=$_.chop==c.to_s puts b&&d&&a+c<12346?:OK: :NG