#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010], c[100010];
int main() {
  int n, m, x;
  int k, l, r;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    c[i] = i;
    for (int j = 1; j <= m; j++) {
      cin >> x;
      if (x < a[j]) b[j] = i;
      a[j] = x;
      if (b[j] < c[i]) c[i] = b[j];
    }
  }
  cin >> k;
  while (k--) {
    cin >> l >> r;
    if (c[r] <= l)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
