#include <bits/stdc++.h>
using namespace std;
long int n, m, i, j, k, cl, cr;
vector<long int> l[100009], arr[100009];
int main() {
  unordered_map<long int, long int> mp;
  cin >> n >> m;
  for (i = 0; i <= n; i++) {
    arr[i].resize(m + 1);
    l[i].resize(m + 1);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%ld", &arr[i][j]);
    }
  }
  for (i = 0; i <= m; i++) {
    arr[0][i] = 0;
    l[0][i] = 0;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (arr[i - 1][j] > arr[i][j]) {
        l[i][j] = i;
        if (mp.find(i) != mp.end())
          mp[i] = min(mp[i], i);
        else
          mp[i] = i;
      } else {
        l[i][j] = l[i - 1][j];
        if (mp.find(i) != mp.end())
          mp[i] = min(mp[i], l[i - 1][j]);
        else
          mp[i] = l[i - 1][j];
      }
    }
  }
  cin >> k;
  while (k--) {
    scanf("%ld %ld", &cl, &cr);
    if (mp[cr] <= cl)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
