#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long nax = 1e5 + 100;
long long n, m;
signed main() {
  cin >> n >> m;
  long long dp[n][m], a[n][m];
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
      dp[i][j] = 1;
    }
  for (long long j = 0; j < m; j++)
    for (long long i = 1; i < n; i++)
      if (a[i][j] >= a[i - 1][j]) dp[i][j] = dp[i - 1][j] + 1;
  for (long long i = 0; i < n; i++) sort(dp[i], dp[i] + m);
  long long q;
  cin >> q;
  while (q--) {
    long long l, r;
    cin >> l >> r;
    --l;
    --r;
    if (dp[r][m - 1] >= (r - l + 1))
      cout << "Yes\n";
    else
      cout << "No\n";
  }
  return 0;
}
