#include <bits/stdc++.h>
using namespace std;
vector<int> a[100001];
int n, m, k, pos, ans[100001], ql[100001], qr[100001];
int out[100001];
int ed;
vector<pair<int, int>> qs[100001];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) a[i].resize(m + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) scanf("%d", a[i].data() + j);
  for (int j = 1; j <= m; ++j) {
    int st = 1;
    for (int i = 1; i < n; ++i) {
      if (a[i][j] > a[i + 1][j]) {
        if (st < i) out[st] = max(out[st], i + 1);
        st = i + 1;
      }
    }
    if (st < n) out[st] = max(out[st], n + 1);
  }
  scanf("%d", &k);
  for (int i = 0; i < k; ++i)
    scanf("%d%d", ql + i, qr + i), ans[i] = ql[i] == qr[i];
  for (int i = 0; i < k; ++i)
    if (ql[i] < qr[i]) {
      qs[ql[i]].emplace_back(qr[i], i);
    }
  for (int i = 1; i <= n; ++i) {
    ed = max(ed, out[i]);
    for (auto&& x : qs[i]) ans[x.second] = x.first < ed;
  }
  for (int i = 0; i < k; ++i) puts(ans[i] ? "Yes" : "No");
}
