← Home
package main

import (
	"bufio"
	"io"
	"os"
)

type fastScanner struct {
	buf []byte
	pos int
}

func newFastScanner() *fastScanner {
	b, _ := io.ReadAll(os.Stdin)
	return &fastScanner{buf: b, pos: 0}
}

func (s *fastScanner) nextInt() int {
	for s.pos < len(s.buf) && s.buf[s.pos] <= ' ' {
		s.pos++
	}
	if s.pos >= len(s.buf) {
		return 0
	}
	res := 0
	for s.pos < len(s.buf) && s.buf[s.pos] > ' ' {
		res = res*10 + int(s.buf[s.pos]-'0')
		s.pos++
	}
	return res
}

func main() {
	sc := newFastScanner()
	n := sc.nextInt()
	if n == 0 {
		return
	}
	q := sc.nextInt()

	a := make([]int32, n+1)
	for i := 1; i <= n; i++ {
		a[i] = int32(sc.nextInt())
	}

	dp := make([][19]int32, n+1)
	var nextPos [19]int32

	for i := n; i >= 1; i-- {
		for j := 0; j < 19; j++ {
			dp[i][j] = int32(n + 1)
		}
		for j := 0; j < 19; j++ {
			if (a[i]&(1<<j)) != 0 {
				dp[i][j] = int32(i)
				nx := nextPos[j]
				if nx != 0 {
					for k := 0; k < 19; k++ {
						if dp[nx][k] < dp[i][k] {
							dp[i][k] = dp[nx][k]
						}
					}
				}
			}
		}
		for j := 0; j < 19; j++ {
			if (a[i]&(1<<j)) != 0 {
				nextPos[j] = int32(i)
			}
		}
	}

	out := bufio.NewWriter(os.Stdout)
	for i := 0; i < q; i++ {
		x := sc.nextInt()
		y := sc.nextInt()

		can := false
		for j := 0; j < 19; j++ {
			if (a[y]&(1<<j)) != 0 {
				if dp[x][j] <= int32(y) {
					can = true
					break
				}
			}
		}
		if can {
			out.WriteString("Shi\n")
		} else {
			out.WriteString("Fou\n")
		}
	}
	out.Flush()
}