#include <bits/stdc++.h>
using namespace std;
vector<int> a, b, res, mn;
int main() {
  int n, m, i, j, q, l, r;
  cin >> n >> m;
  a.resize(m);
  b.resize(m);
  mn.resize(m);
  res.resize(n, 1e9 + 100);
  res[0] = 0;
  for (i = 0; i < m; i++) cin >> b[i];
  for (i = 1; i < n; i++)
    for (j = 0; j < m; j++) {
      cin >> a[j];
      if (a[j] < b[j]) mn[j] = i;
      res[i] = min(res[i], mn[j]);
      b[j] = a[j];
    }
  cin >> q;
  for (i = 0; i < q; i++) {
    cin >> l >> r;
    l--;
    r--;
    if (res[r] > l)
      cout << "No";
    else
      cout << "Yes";
    cout << endl;
  }
  return 0;
}
