#include <bits/stdc++.h>
using namespace std;
long long fpow(long long a, int b, int mod) {
  long long res = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res % mod;
}
const int mod = 1e9 + 7;
const int N = 1e5 + 100;
inline int read() {
  static char buf[1000000], *p1 = buf, *p2 = buf;
  register int x = false;
  register char ch =
      p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
          ? EOF
          : *p1++;
  ;
  register bool sgn = false;
  while (ch != '-' && (ch < '0' || ch > '9'))
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  if (ch == '-')
    sgn = true,
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ 48),
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  return sgn ? -x : x;
}
vector<int> G[N];
int d[N];
int mx[N];
int main() {
  int n = read(), m = read();
  for (int i = 1; i <= m + 1; i++) G[0].push_back(0);
  for (int i = 1; i <= n; i++) {
    G[i].push_back(0);
    for (int j = 1; j <= m; j++) {
      int num = read();
      G[i].push_back(num);
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (G[j][i] >= G[j - 1][i])
        d[j] = d[j - 1] + 1;
      else
        d[j] = 1;
      mx[j] = max(mx[j], d[j]);
    }
    for (int j = 1; j <= n; j++) d[j] = 0;
  }
  int k;
  k = read();
  while (k--) {
    int L, R;
    L = read(), R = read();
    if (mx[R] >= R - L + 1)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
