#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> t(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> t[i][j];
    }
  }
  vector<vector<int>> t1(n, vector<int>(m, 0));
  for (int i = 0; i < m; ++i) t1[0][i] = 1;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (t[i][j] >= t[i - 1][j])
        t1[i][j] = 1;
      else
        t1[i][j] = 0;
    }
  }
  vector<vector<int>> t2(n, vector<int>(m));
  for (int j = 0; j < m; ++j) {
    for (int i = n - 1; i >= 0; --i) {
      int cur = i;
      t2[i][j] = i;
      while (i > 0 && t1[i][j]) {
        --i;
        t2[i][j] = cur;
      }
    }
  }
  for (int i = 0; i < m; ++i) t2[n - 1][i] = n - 1;
  vector<int> ck(n, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      ck[i] = max(ck[i], t2[i][j]);
    }
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int l, r;
    cin >> l >> r;
    --l;
    --r;
    if (l == r || ck[l] >= r) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }
  return 0;
}
