#include <bits/stdc++.h>
using namespace std;
int a[500000], mem[500000][20], nextt[500000][20], N;
int dp(int curr, int way) {
  if (mem[curr][way] != -1) return mem[curr][way];
  if (a[curr] & (1 << way)) return curr;
  int mn = N, i;
  for (i = 0; i < 19; i++) {
    if ((a[curr] & (1 << i)) && (nextt[curr][i] != -1))
      mn = min(mn, dp(nextt[curr][i], way));
  }
  return mem[curr][way] = mn;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int i, j, q, x, y, mn, temp;
  vector<int> v;
  cin >> N >> q;
  for (i = 0; i < N; i++) {
    cin >> a[i];
    for (j = 0; j < 19; j++) {
      mem[i][j] = -1;
      nextt[i][j] = -1;
    }
  }
  for (i = 0; i < 19; i++) {
    temp = (1 << i);
    v.clear();
    for (j = 0; j < N; j++)
      if (temp & a[j]) v.push_back(j);
    for (j = 1; j < v.size(); j++) {
      nextt[v[j - 1]][i] = v[j];
    }
  }
  for (i = 0; i < q; i++) {
    cin >> x >> y;
    x--, y--;
    mn = N;
    for (j = 0; j < 19; j++) {
      if (a[y] & (1 << j)) mn = min(mn, dp(x, j));
    }
    if (mn <= y)
      cout << "Shi\n";
    else
      cout << "Fou\n";
  }
}
