#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  int n, m;
  cin >> n >> m;
  vector<vector<int> > a(n, vector<int>(m));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  vector<int> ri(n, 0);
  for (int j = 0; j < m; j++) {
    int last = n - 1;
    ri[n - 1] = n - 1;
    for (int i = n - 2; i >= 0; i--) {
      if (a[i + 1][j] < a[i][j]) last = i;
      ri[i] = max(ri[i], last);
    }
  }
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    int l, r;
    cin >> l >> r;
    if (r - 1 > ri[l - 1])
      cout << "No\n";
    else
      cout << "Yes\n";
  }
  return 0;
}
