#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char ch) {
  ch = tolower(ch);
  return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
bool isprime(int n) {
  if (n < 2 || (n % 2 == 0 && n != 2)) return false;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int n, m, i, j;
  cin >> n >> m;
  int dp[n + 1][m + 1], a[n + 1][m + 1];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  int mx[n + 1];
  for (i = 1; i <= m; i++) {
    dp[1][i] = 1;
  }
  mx[1] = 1;
  for (i = 2; i <= n; i++) {
    mx[i] = 0;
    for (j = 1; j <= m; j++) {
      if (a[i - 1][j] <= a[i][j]) {
        dp[i][j] = dp[i - 1][j] + 1;
      } else {
        dp[i][j] = 1;
      }
      mx[i] = max(mx[i], dp[i][j]);
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int x, y, flag = 0;
    cin >> x >> y;
    if (mx[y] >= y - x + 1) {
      flag++;
    }
    if (flag)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
