class FastFactorization: """ 1 ~ Nの整数を全て素因数分解する O(N√N) -> O(NlogN) Parameters ----------- N : int 操作対象の上限値 Notes ----------- 前処理にO(NloglogN), クエリでO(logN) """ def __init__(self, N): self.N = N self.min_factor = [0] * (N+1) self.__Eratosthenes() def __Eratosthenes(self): """ 前処理, O(NloglogN) """ self.min_factor[1] = 1 for p in range(2, self.N+1): if self.min_factor[p] : continue for q in range(p, self.N+1, p): self.min_factor[q] = p # 高速素因数分解 def factorize(self, n): """ 素因数分解を行う,O(logN) Parameters ----------- n : int 操作対象 Returns ----------- res : list(tuple[int, int]) 素因数,冪数を返す。 """ res = 0 while n > 1: p = self.min_factor[n] while n % p == 0: n //= p res += 1 return res N = int(input()) A = list(map(int, input().split())) ff = FastFactorization(1000000) grundy = 0 for a in A: grundy ^= ff.factorize(a) if grundy == 0: print('black') else: print('white')