#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  while (a && b) a > b ? a %= b : b %= a;
  return a + b;
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, n, m, q, l, r;
  cin >> n >> m;
  long long int a[n][m];
  int pre[n][m];
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < m; ++i) {
    pre[0][i] = 0;
  }
  for (i = 1; i < n; i++) {
    for (j = 0; j < m; ++j) {
      if (a[i][j] >= a[i - 1][j]) {
        pre[i][j] = pre[i - 1][j] + 1;
      } else {
        pre[i][j] = pre[i - 1][j];
      }
    }
  }
  cin >> q;
  vector<pair<int, int>> v;
  map<pair<int, int>, pair<bool, bool>> mapper;
  for (i = 0; i < q; ++i) {
    cin >> l >> r;
    l--;
    r--;
    v.push_back(make_pair(l, r));
    mapper.insert(make_pair(make_pair(l, r), make_pair(false, false)));
  }
  for (j = 0; j < q; ++j) {
    l = v[j].first;
    r = v[j].second;
    auto it = mapper.find(make_pair(l, r));
    if (it->second.first) {
      if (it->second.second)
        cout << "Yes" << '\n';
      else
        cout << "No" << '\n';
    } else {
      if (l == r) {
        it->second.second = true;
        it->second.first = true;
        cout << "Yes" << '\n';
        continue;
      }
      for (i = 0; i < m; ++i) {
        if (pre[r][i] - pre[l][i] >= (r - l)) {
          it->second.second = true;
          it->second.first = true;
          cout << "Yes" << '\n';
          break;
        }
      }
      if (i == m) {
        it->second.second = false;
        it->second.first = true;
        cout << "No" << '\n';
      }
    }
  }
  return 0;
}
