#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 100;
long long n, m, k, l, r, x, start[MX], a1[MX], a2[MX], dp[MX];
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < MX; i++) dp[i] = 1e9, start[i] = 1;
  for (int j = 1; j <= m; j++) cin >> a1[j];
  dp[1] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a2[j];
      if (a2[j] < a1[j]) {
        start[j] = i;
      }
      a1[j] = a2[j];
    }
    for (int q = 1; q <= m; q++) {
      dp[i] = min(dp[i], start[q]);
    }
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> l >> r;
    if (dp[r] <= l)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
