import java.util.Scanner; import java.util.InputMismatchException; public class KnightWalk { static Scanner scanner = new Scanner(System.in); public static void main(String[] args){ int X = Input(-1000000000 , 1000000000); int Y = Input(-1000000000 , 1000000000); scanner.close(); boolean Answer = Judge(X , Y , 0 , 0 , 0); if(Answer){ System.out.println("YES"); }else{ System.out.println("NO"); } } public static int Input(int Min , int Max){ int Number = scanner.nextInt(); try{ if(Number < Min || Number > Max){ System.out.println(Min + "以上" + Max + "以下で入力してください"); System.exit(0); } }catch(InputMismatchException e){ System.out.println("数字を入力してください"); System.exit(0); }catch(Exception E){ System.out.println("想定外のエラーです"); System.exit(0); } return Number; } public static boolean Judge(int X , int Y , int NowX , int NowY , int Count){ int[] Xwidth = {1,2,2,1,-1,-2,-2,-1}; int[] Ywidth = {2,1,-1,-2,-2,-1,1,2}; if(NowX == X && NowY == Y){ return true; } if(Count == 3){ return false; } for(int i = 0 ; i < Xwidth.length ; i++){ if(Judge(X , Y , NowX + Xwidth[i] , NowY + Ywidth[i] , Count + 1)){ return true; } } return false; } }