public static void main(String[] args)throws Exception {
        init();
        entrance();
        Scanner scanner=new Scanner(System.in);
        int cases=scanner.nextInt();
        while (cases-->0){
            System.out.println(aux[getIndex(scanner.nextInt(),scanner.nextInt(),scanner.nextInt())]?"YES":"NO");
        }
//        System.out.println(getIndex(2001,11,3));
    }