#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int **a = new long long int *[n];
  for (long long int i = 0; i < n; i++) {
    a[i] = new long long int[m];
    for (long long int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  long long int **dp = new long long int *[n];
  for (long long int i = 0; i < n; i++) {
    dp[i] = new long long int[m]();
  }
  for (long long int i = 0; i < m; i++) {
    dp[0][i] = 1;
  }
  long long int *ans = new long long int[n]();
  ans[0] = 1;
  for (long long int i = 1; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (a[i][j] >= a[i - 1][j]) {
        dp[i][j] = dp[i - 1][j] + 1;
      } else {
        dp[i][j] = 1;
      }
      ans[i] = max(ans[i], dp[i][j]);
    }
  }
  long long int k;
  cin >> k;
  while (k--) {
    long long int l, r;
    cin >> l >> r;
    if (ans[r - 1] >= (r - l + 1)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
