import java.util.*;

public class Antti {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        long[] t = new long[n];
        long[] a = new long[n];
        long[] b = new long[n];
        long mf = 0, mt = 0;
        for (int i = 0; i < n; i++) {
            t[i] = input.nextInt();
            a[i] = input.nextInt();
            b[i] = input.nextInt();
            b[i] -= a[i];
            mf += a[i];
            mt += a[i]*t[i];
        }
        // bubble sort ftw
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n-1; j++) {
                if (t[j] > t[j+1]) {
                    long x;
                    x = t[j]; t[j] = t[j+1]; t[j+1] = x;
                    x = b[j]; b[j] = b[j+1]; b[j+1] = x;
                }
            }
        }
        int r = input.nextInt();
        for (int i = 1; i <= r; i++) {
            long x = input.nextInt();
            long y = input.nextInt();
            if (y < mf) {
                System.out.println("no");
                continue;
            }
            long ay = y-mf;
            long at = mt;
            for (int j = 0; j < n; j++) {
                long nf = Math.min(b[j],ay);
                ay -= nf;
                at += nf*t[j];
            }
            long by = y-mf;
            long bt = mt;
            for (int j = n-1; j >= 0; j--) {
                long nf = Math.min(b[j],by);
                by -= nf;
                bt += nf*t[j];
            }
            if (ay == 0 && at <= x*y && x*y <= bt) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
    }
}
