#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void pp(T... args) {
  ((cout << args << " "), ...);
  cout << "\n";
}
template <typename... T>
void po(T... args) {
  ((cout << args << " "), ...);
  cout << "";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int test = 1;
  for (int tt = 1; tt <= test; tt++) {
    int n, m;
    cin >> n >> m;
    long long int a[n][m];
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < m; j++) {
        cin >> a[i][j];
      }
    }
    long long int dp[n];
    dp[0] = 0;
    for (long long int i = 1; i < n; i++) {
      dp[i] = INT_MAX;
    }
    for (long long int j = 0; j < m; j++) {
      long long int chk = 0;
      for (long long int i = 1; i < n; i++) {
        if (a[i][j] < a[i - 1][j]) chk = i;
        dp[i] = min(dp[i], chk);
      }
    }
    int q;
    cin >> q;
    while (q--) {
      int l, r;
      cin >> l >> r;
      l--;
      r--;
      if (dp[r] <= l)
        pp("Yes");
      else
        pp("No");
    }
  }
  return 0;
}
