#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MOD2 = 15000007;
const long long int MAX = 9187201950435737471;
const int N = 100005;
const int M = 100005;
const int INF = 2;
const double EPS = 1e-9;
const long double PI = acos(-1);
long long int po(long long int x, long long int y) {
  long long int ret = 1;
  while (y > 0) {
    if (y & 1) {
      ret = (ret * x);
    }
    y = y >> 1ll;
    x = (x * x);
  }
  return ret;
}
int a[N];
int dp[N][3];
int n;
int f(int idx, int turn) {
  if (dp[idx][turn] != -1) return dp[idx][turn];
  if (a[idx] == n) return 1;
  int ret = 0;
  for (int i = 1; i <= n; i++) {
    if (i * a[idx] >= n) break;
    if ((i * a[idx]) + idx < n && a[(i * a[idx]) + idx] > a[idx]) {
      ret |= f((i * a[idx]) + idx, 1 ^ turn);
    }
    if (idx - (i * a[idx]) >= 0 && a[idx - (i * a[idx])] > a[idx]) {
      ret |= f(idx - (i * a[idx]), 1 ^ turn);
    }
  }
  return dp[idx][turn] = ret ^ 1;
}
void solve(int T) {
  int n, m;
  cin >> n >> m;
  int a[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  vector<int> r(n);
  for (int i = 0; i < n; i++) r[i] = -1;
  for (int j = 0; j < m; j++) {
    int lst;
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        lst = 0;
      } else {
        if (a[i][j] < a[i - 1][j]) {
          lst = i;
        }
      }
      r[lst] = max(r[lst], i);
    }
  }
  for (int i = 1; i < n; i++) {
    r[i] = max(r[i], r[i - 1]);
  }
  int k;
  cin >> k;
  while (k--) {
    int l, f;
    cin >> l >> f;
    l--;
    f--;
    if (r[l] >= f)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  for (int i = 1; i <= T; i++) {
    solve(i);
  }
  return 0;
}
