#include <bits/stdc++.h>
using namespace std;
long long int fpow(long long int n, long long int k,
                   long long int p = 1000000007) {
  long long int r = 1;
  n = n % p;
  while (k > 0) {
    if (k & 1) {
      r = (r * n) % p;
    }
    k = k >> 1;
    n = (n * n) % p;
  }
  return r;
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  long long int a[n][m];
  long long int b[n][m];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> a[i][j];
      b[i][j] = 1;
    }
  }
  for (long long int j = 0; j < m; j++) {
    for (long long int i = 1; i < n; i++) {
      if (a[i][j] >= a[i - 1][j]) {
        b[i][j] = b[i - 1][j] + 1;
      }
    }
  }
  long long int st[n];
  memset(st, 0, sizeof(st));
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      st[i] = max(st[i], b[i][j]);
    }
  }
  long long int q;
  cin >> q;
  while (q--) {
    long long int l, r;
    cin >> l >> r;
    long long int flag = 1;
    l--;
    r--;
    if (l == r) {
      cout << "Yes\n";
      continue;
    }
    if (st[r] >= r - l + 1)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
