#include <bits/stdc++.h>
using namespace std;
const int len = 1e5 + 5;
const long long mod = 1e9 + 7;
const unsigned long long seed = 131;
struct PP {
  int first, second;
};
int cmp(PP a, PP b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}
vector<int> dd[len];
set<pair<int, int> > se;
vector<PP> ve;
int a[len], b[len];
int main() {
  int n, m;
  cin >> n >> m;
  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, r = 0;
    for (int i = 0; i < n - 1; ++i) {
      if (w == 0 && dd[i][j] <= dd[i + 1][j])
        l = i, w = 1;
      else if (w == 1 && dd[i][j] > dd[i + 1][j]) {
        r = i;
        w = 0;
        if (se.count({l, r}) == 0) {
          se.insert({l, r});
          ve.push_back({l, r});
        }
      }
    }
    if (w == 1 && se.count({l, n - 1}) == 0) {
      se.insert({l, n - 1});
      ve.push_back({l, n - 1});
    }
  }
  sort(ve.begin(), ve.end(), cmp);
  for (int i = 0; i < ve.size(); ++i) a[i] = ve[i].first, b[i] = ve[i].second;
  int q;
  cin >> q;
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    l--;
    r--;
    if (l == r) {
      puts("Yes");
      continue;
    }
    int x = upper_bound(a, a + ve.size(), l) - a;
    int flag = 0;
    for (int i = 0; i < x; ++i)
      if (r <= b[i]) {
        flag = 1;
        break;
      }
    if (flag)
      puts("Yes");
    else
      puts("No");
  }
}
