import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class delaunay_ak_50 {

	static final double EPS = 1e-9;
	
	static class Point implements Comparable<Point> {
		final long x, y;
		
		Point(long x, long y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(Point p) {
			if (x != p.x) {
				return Long.compare(x, p.x);
			}
			return Long.compare(y, p.y);
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + (int) (x ^ (x >>> 32));
			result = prime * result + (int) (y ^ (y >>> 32));
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Point other = (Point) obj;
			if (x != other.x)
				return false;
			if (y != other.y)
				return false;
			return true;
		}	
		
		@Override
		public String toString() {
			return "(" + x + ", " + y + ")";
		}		
	}
	
	static boolean leftOrRightDoesntMatterTurn(Point a, Point b, Point c) {
		long x1 = b.x - a.x;
		long y1 = b.y - a.y;
		long x2 = c.x - a.x;
		long y2 = c.y - a.y;
		return (x1 * y2 - x2 * y1) < 0;
	}
	
	static boolean inOrOnCircle(Point a, Point b, Point c, Point d) {
		if (leftOrRightDoesntMatterTurn(a, b, c)) {
			return inOrOnCircle(b, a, c, d);
		}
	    double dx = d.x, dy = d.y;
	    double ax = a.x, ay = a.y;
	    double bx = b.x, by = b.y;
	    double cx = c.x, cy = c.y;
	    double a00 = ax - dx, a01 = ay - dy;
	    double a02 = (ax * ax - dx * dx) + (ay * ay - dy * dy);
	    double a10 = bx - dx, a11 = by - dy;
	    double a12 = (bx * bx - dx * dx) + (by * by - dy * dy);
	    double a20 = cx - dx, a21 = cy - dy;
	    double a22 = (cx * cx - dx * dx) + (cy * cy - dy * dy);
	    double d1 = a00 * a11 * a22;
	    double d2 = a01 * a12 * a20;
	    double d3 = a02 * a10 * a21;
	    double d4 = a00 * a12 * a21;
	    double d5 = a01 * a10 * a22;
	    double d6 = a02 * a11 * a20;
	    double det = d1 + d2 + d3 - d4 - d5 - d6;
//	    System.err.println(a + " " + b + " " + c + " " + d + " " + det + " " + (det <= EPS));
	    return det >= EPS;
	}
	
	static class Segment {
		final Point a, b;
		Point another1, another2;
		
		private Segment(Point a, Point b) {
			if (a.compareTo(b) > 0) {
				this.a = b;
				this.b = a;
			} else {
				this.a = a;
				this.b = b;
			}
		}
		
		void addAnother(Point p) {
			if (another1 == null) {
				another1 = p;
			} else if (another2 == null) {
				another2 = p;
			} else {
				throw new AssertionError();
			}
		}
		
		boolean needFlip() {
			if (another2 == null) {
				if (another1 == null) {
					throw new AssertionError();
				}
				return true;
			}
			return !inOrOnCircle(a, b, another1, another2) && !inOrOnCircle(a, b, another2, another1);
		}
		
		static Map<Segment, Segment> id = new HashMap<Segment, Segment>();

        static void clear() {
            id = new HashMap<>();
        }

		static Segment create(Point p1, Point p2) {
			Segment res = new Segment(p1, p2);
			if (!id.containsKey(res)) {
				id.put(res, res);
			}
			return id.get(res);
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + ((a == null) ? 0 : a.hashCode());
			result = prime * result + ((b == null) ? 0 : b.hashCode());
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Segment other = (Segment) obj;
			if (a == null) {
				if (other.a != null)
					return false;
			} else if (!a.equals(other.a))
				return false;
			if (b == null) {
				if (other.b != null)
					return false;
			} else if (!b.equals(other.b))
				return false;
			return true;
		}		
	}
	
	boolean solve1() throws IOException {
		int n = in.nextInt();
        if (n > 1000) {
            throw new AssertionError("n = " + n);
        }
		int m = in.nextInt();
//        System.err.println(n + " " + m);
        Point[] points = new Point[n];
		for (int i = 0; i < n; i++) {
			points[i] = new Point(in.nextInt(), in.nextInt());			
		}
		ArrayList<Segment> s = new ArrayList<Segment>();		
		for (int i = 0; i < m; i++) {
			Point[] p = new Point[3];
			for (int j = 0; j < 3; j++) {
				p[j] = points[in.nextInt() - 1];
			}
			for (int j = 0; j < 3; j++) {
				Point here = p[j];
				Point next = p[(j + 1) % 3];
				Point next2 = p[(j + 2) % 3];
				Segment seg = Segment.create(here, next);
				seg.addAnother(next2);
				s.add(seg);
			}
		}
		boolean ok = true;
		for (int i = 0; i < s.size(); i++) {
			ok &= s.get(i).needFlip();
		}
		return ok;
	}
	
	void solve() throws IOException {
		int t = in.nextInt();
		for (int i = 0; i < t; i++) {
            Segment.clear();
			out.println(solve1() ? "YES" : "NO");
		}
	}

	static MyScanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		in = new MyScanner(new FileReader("delaunay.in"));
		out = new PrintWriter("delaunay.out");

		new delaunay_ak_50().solve();
		out.close();
	}

	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		MyScanner(Reader r) {
			br = new BufferedReader(r);
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

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