#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  long long n, m;
  cin >> n;
  cin >> m;
  vector<vector<long long> > mat(n + 1, vector<long long>(m + 1, 0));
  for (int i = 1; i < 1 + n; ++i)
    for (int j = 1; j < 1 + m; ++j) cin >> mat[i][j];
  vector<vector<int> > dp(n + 1, vector<int>(m + 1, 0));
  for (int i = 1; i < m + 1; ++i) dp[n][i] = n;
  for (int i = n - 1; i >= 1; --i) {
    for (int j = 1; j < m + 1; ++j) {
      if (mat[i][j] <= mat[i + 1][j])
        dp[i][j] = dp[i + 1][j];
      else
        dp[i][j] = i;
    }
  }
  mat.clear();
  vector<int> farthest(n + 1, 0);
  long long max = 0;
  for (int i = 1; i < n + 1; ++i) {
    max = dp[i][1];
    for (int j = 2; j < m + 1; ++j) {
      if (dp[i][j] > max) max = dp[i][j];
    }
    farthest[i] = max;
  }
  long long k, s, e;
  cin >> k;
  bool found;
  for (int i = 0; i < k; ++i) {
    cin >> s;
    cin >> e;
    if (farthest[s] >= e) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
