#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int k;
  cin >> m >> n;
  vector<vector<int> > A;
  int dp[m + 1];
  A.clear();
  vector<int> p;
  for (int i = 1; i <= m; i++) {
    p.clear();
    for (int j = 1; j <= n; j++) {
      cin >> k;
      p.push_back(k);
    }
    A.push_back(p);
  }
  for (int i = 0; i < m; i++) {
    dp[i] = i;
  }
  int start = 0;
  for (int j = 0; j < n; j++) {
    start = 0;
    for (int i = 1; i < m; i++) {
      if (A[i][j] < A[i - 1][j]) {
        if (dp[start] < i - 1 && start < i - 1) {
          dp[start] = i - 1;
        }
        start = i;
      }
    }
    if (start < m - 1) {
      dp[start] = m - 1;
    }
  }
  int finish = 0;
  for (int i = 0; i < m; i++) {
    if (finish > i) {
      if (dp[i] < finish) {
        dp[i] = finish;
      } else {
        finish = dp[i];
      }
    } else {
      finish = dp[i];
    }
  }
  cin >> k;
  int x, y;
  int ans;
  for (int i = 0; i < k; i++) {
    cin >> x >> y;
    x--;
    y--;
    if (dp[x] >= y) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
