#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3f;
const long long M = 1e9 + 7;
const long long N = 1e6 + 7;
const double eps = 0.00000001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a, T b) {
  return a > 0 ? a : -a;
}
int n, m;
vector<int> a[N], dp[N];
int q[N];
int qq;
int i, j, k;
int l, r;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    a[i].push_back(0);
    dp[i].push_back(0);
    for (j = 1; j <= m; j++) {
      cin >> k;
      a[i].push_back(k);
      dp[i].push_back(0);
    }
  }
  for (j = 1; j <= m; j++) {
    k = 1;
    dp[1][j] = 1;
    for (i = 2; i <= n; i++) {
      if (a[i][j] < a[i - 1][j]) k = i;
      dp[i][j] = k;
    }
  }
  for (i = 1; i <= n; i++) {
    k = i;
    for (j = 1; j <= m; j++)
      if (dp[i][j] < k) k = dp[i][j];
    q[i] = k;
  }
  cin >> qq;
  for (i = 0; i < qq; i++) {
    cin >> l >> r;
    if (q[r] <= l)
      puts("Yes");
    else
      puts("No");
  }
}
