#include <bits/stdc++.h>
using namespace std;
int dp(vector<int>& table, const vector<bitset<19>>& a, int sb, int eb, int z) {
  int idx = z;
  idx *= 20;
  idx += sb;
  while (table[idx] == -1) {
    if (sb == eb) {
      table[idx] = z;
      break;
    }
    if (z >= a.size()) {
      table[idx] = INT_MAX;
      break;
    }
    table[idx] = INT_MAX;
    if (sb == 19) {
      for (int i = 0; i < 19; i++) {
        if (a[z][i]) table[idx] = min(table[idx], dp(table, a, i, eb, z + 1));
      }
    } else {
      if (a[z][sb]) {
        table[idx] = min(table[idx], dp(table, a, 19, eb, z));
      }
      table[idx] = min(table[idx], dp(table, a, sb, eb, z + 1));
    }
  }
  return table[idx];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  vector<bitset<19>> a(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i] = x;
  }
  vector<pair<int, int>> queries(q);
  vector<int> per_eb[19];
  vector<bool> soln(q, false);
  for (int i = 0; i < 19; i++) {
    per_eb[i].reserve(n);
  }
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    queries[i] = make_pair(x, y);
    for (int j = 0; j < 19; j++) {
      if (a[y][j]) per_eb[j].push_back(i);
    }
  }
  vector<int> table((n + 1) * 20, -1);
  for (int j = 0; j < 19; j++) {
    table.assign(table.size(), -1);
    for (int k = 0; k < per_eb[j].size(); k++) {
      int z = per_eb[j][k];
      int x = queries[z].first;
      int y = queries[z].second;
      int t = dp(table, a, 19, j, x);
      if (t <= y) {
        soln[z] = true;
      }
    }
  }
  for (int i = 0; i < q; i++) {
    cout << (soln[i] ? "Shi" : "Fou") << "\n";
  }
  fflush(stdout);
  return 0;
}
