#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<vector<int>> a(n, vector<int>(m, 0));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  vector<int> dp(m, 1);
  vector<int> len = {1};
  for (int i = n - 2; i >= 0; i--) {
    int ml = 0;
    for (int j = 0; j < m; j++) {
      if (a[i + 1][j] >= a[i][j])
        dp[j]++;
      else
        dp[j] = 1;
      ml = max(ml, dp[j]);
    }
    len.push_back(ml);
  }
  reverse(len.begin(), len.end());
  int k, l, r;
  scanf("%d", &k);
  while (k--) {
    scanf("%d %d", &l, &r);
    if (len[l - 1] >= r - l + 1)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
