#include <bits/stdc++.h>
using namespace std;
const int len = 1e5 + 5;
const long long mod = 1e9 + 7;
const unsigned long long seed = 131;
vector<int> dd[len];
int ans[len];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) ans[i] = i;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int t;
      scanf("%d", &t);
      dd[i].push_back(t);
    }
  }
  for (int j = 0; j < m; ++j) {
    int w = 0, l = 0;
    for (int i = 0; i < n - 1; ++i) {
      if (w == 0 && dd[i][j] <= dd[i + 1][j]) {
        w = 1;
        l = i;
        ans[i + 1] = min(ans[i + 1], l);
      } else if (w == 1) {
        if (dd[i][j] <= dd[i + 1][j])
          ans[i + 1] = min(ans[i + 1], l);
        else
          w = 0;
      }
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    l--;
    r--;
    if (ans[r] <= l)
      puts("Yes");
    else
      puts("No");
  }
}
