#include <bits/stdc++.h>
using namespace std;
int const N = 500001;
int n, m, mx[N], sg[4 * N];
bool srt(pair<int, int> a, pair<int, int> b) {
  if (a.first < b.first) return true;
  return a.first > b.first ? false : (a.second >= b.second);
}
int main() {
  scanf("%d%d", &n, &m);
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int x;
      scanf("%d", &x);
      v.push_back(x);
    }
  }
  vector<pair<int, int> > range;
  for (int j = 0; j < m; ++j) {
    int prv = 0, l = 0, r = 0;
    for (int i = 0; i < n; ++i) {
      int x = v[j + i * m];
      if (x >= prv) {
        r = i;
      } else {
        range.push_back({l, r});
        l = r = i;
      }
      prv = x;
    }
    range.push_back({l, r});
  }
  int q;
  scanf("%d", &q);
  sort(range.begin(), range.end());
  int mx0 = 0;
  for (int i = 0; i < range.size(); ++i) {
    mx[range[i].first] = max({mx[range[i].first], range[i].second, mx0});
    mx0 = max(mx0, mx[range[i].first]);
  }
  for (int i = 0; i < n; ++i) mx[i] = max(mx[i], mx[max(i - 1, 0)]);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    --l, --r;
    if (mx[l] >= r)
      puts("Yes");
    else
      puts("No");
  }
}
