#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, q;
  cin >> n >> m;
  vector<vector<long long>> arr, dp;
  arr.resize(n, vector<long long>(m));
  dp.resize(n, vector<long long>(m));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) cin >> arr[i][j];
  }
  for (long long i = 0; i < m; i++) dp[0][i] = 0;
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      if (arr[i][j] >= arr[i - 1][j])
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = i;
    }
  }
  vector<long long> mi(n, INT_MAX);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      mi[i] = min(mi[i], dp[i][j]);
    }
  }
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long a, b;
    bool flag = false;
    cin >> a >> b;
    a--;
    b--;
    if (mi[b] <= a) flag = true;
    if (flag)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
