#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, q;
  cin >> n >> q;
  vector<int> a((size_t)n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<pair<int, int>> b((size_t)q);
  for (int i = 0; i < q; i++) {
    cin >> b[i].first >> b[i].second;
    b[i].first--, b[i].second--;
  }
  int m = 22;
  vector<vector<int>> c((size_t)m, vector<int>((size_t)m, n));
  vector<vector<int>> d((size_t)m, vector<int>((size_t)m, n));
  vector<vector<int>> e((size_t)n, vector<int>((size_t)m, n));
  for (int i = n - 1; i >= 0; i--) {
    c = vector<vector<int>>((size_t)m, vector<int>((size_t)m, n));
    vector<int> x((size_t)m, n);
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < m; k++) {
        if ((a[i] & (1 << j)) != 0 && (a[i] & (1 << k)) != 0) {
          c[j][k] = i;
        } else if ((a[i] & (1 << j)) != 0 || (a[i] & (1 << k)) != 0) {
          if ((a[i] & (1 << j)) != 0) {
            c[j][k] = d[j][k];
          }
          if ((a[i] & (1 << j)) != 0) {
            x[k] = min(x[k], c[j][k]);
          }
        }
      }
    }
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < m; k++) {
        if ((a[i] & (1 << j)) != 0 && (a[i] & (1 << k)) == 0) {
          c[j][k] = min(c[j][k], x[k]);
        }
        e[i][j] = min(e[i][j], c[j][k]);
        e[i][k] = min(e[i][k], c[j][k]);
        d[j][k] = min(d[j][k], c[j][k]);
      }
    }
  }
  for (int i = 0; i < q; i++) {
    bool f = false;
    for (int j = 0; j < m; j++) {
      if ((a[b[i].second] & (1 << j)) != 0) {
        if (e[b[i].first][j] <= b[i].second) {
          f = true;
          break;
        }
      }
    }
    cout << (f ? "Shi" : "Fou") << endl;
  }
}
