#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int num1[maxn];
int num2[maxn];
int dis[maxn];
int main() {
  int n, m;
  int k;
  int t;
  int l, r;
  while (~scanf("%d %d", &n, &m)) {
    for (int i = 0; i < m; i++) {
      scanf("%d", &num1[i]);
      num2[i] = 1;
    }
    dis[0] = 1;
    for (int i = 1; i < n; i++) {
      dis[i] = i + 1;
      for (int j = 0; j < m; j++) {
        scanf("%d", &t);
        if (t >= num1[j]) {
          dis[i] = min(dis[i], num2[j]);
        } else {
          num2[j] = i + 1;
        }
        num1[j] = t;
      }
    }
    scanf("%d", &k);
    while (k--) {
      bool flag = false;
      ;
      scanf("%d %d", &l, &r);
      if (dis[r - 1] <= l) {
        flag = true;
      }
      if (flag) {
        puts("Yes");
      } else {
        puts("No");
      }
    }
  }
  return 0;
}
