CQXYM wants to create a connected undirected graph with n nodes and m edges, and the diameter of the graph must be strictly less than k-1. Also, CQXYM doesn't want a graph that contains self-loops or multiple edges (i.e. each edge connects two different vertices and between each pair of vertices there is at most one edge).

The diameter of a graph is the maximum distance between any two nodes.

The distance between two nodes is the minimum number of the edges on the path which endpoints are the two nodes.

CQXYM wonders whether it is possible to create such a graph.

Input

The input consists of multiple test cases. 

The first line contains an integer t (1 ≤ t ≤ 10^5) — the number of test cases. The description of the test cases follows.

Only one line of each test case contains three integers n(1 ≤ n ≤ 10^9), m, k (0 ≤ m,k ≤ 10^9).

Output

For each test case, print YES if it is possible to create the graph, or print NO if it is impossible. You can print each letter in any case (upper or lower).

Example

Input


5
1 0 3
4 5 3
4 6 3
5 4 1
2 1 1


Output


YES
NO
YES
NO
NO

Note

In the first test case, the graph's diameter equal to 0.

In the second test case, the graph's diameter can only be 2.

In the third test case, the graph's diameter can only be 1.
// Generated by Code Flattener.
// https://plugins.jetbrains.com/plugin/9979-idea-code-flattener

import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        Solution solution = new ASolution();
        boolean local = System.getProperty("ONLINE_JUDGE") == null && !solution.isInteractive();
        String input = local ? "input.txt" : null;
        solution.in = new MyScanner(input);
        solution.out = MyWriter.of(null);
        solution.bm = new Benchmark();
        solution.al = new Algorithm();
        solution.run();
        solution.close();
    }

    private abstract static class Solution {
        public MyScanner in;
        public MyWriter out;
        public Benchmark bm;
        public Algorithm al;

        public void init() {
        }

        public abstract void solve();

        protected boolean isMultiTest() {
            return true;
        }

        public void run() {
            init();
            if (isMultiTest()) {
                int t = in.nextInt();
                for (int i = 0; i < t; i++) {
                    solve();
                }
            } else {
                solve();
            }
        }

        public void close() {
            out.close();
        }

        public boolean isInteractive() {
            return false;
        }
    }

    private static class ASolution extends Solution {
        public void solve() {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();

            if (k < 2) {
                out.println("NO");
            } else if (k == 2) {
                if (n == 1 && m == 0) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            } else if (k == 3) {
                if (m == n * (n - 1L) / 2) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            } else {
                if (m >= n - 1 && m <= n * (n - 1L) / 2) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            }
        }
    }

    private static class MyScanner {
        private final BufferedReader br;
        private StringTokenizer st;

        public MyScanner(String fileName) {
            if (fileName != null) {
                try {
                    File file = new File(getClass().getClassLoader().getResource(fileName).getFile());
                    br = new BufferedReader(new FileReader(file));
                } catch (FileNotFoundException e) {
                    throw new RuntimeException(e);
                }
            } else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String nextLine() {
            try {
                String line = br.readLine();
                if (line == null) {
                    throw new RuntimeException("empty line");
                }
                st = null;
                return line;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

    private static class Benchmark {
    }

    private static class Algorithm {
    }

    private static class MyWriter extends PrintWriter {
        public static MyWriter of(String fileName) {
            if (fileName != null) {
                try {
                    return new MyWriter(new FileWriter(fileName));
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } else {
                return new MyWriter(new BufferedOutputStream(System.out));
            }
        }

        public MyWriter(Writer writer) {
            super(writer);
        }

        public MyWriter(OutputStream out) {
            super(out);
        }
    }
}