require 'prime' # https://yukicoder.me/submissions/174004 @dp={} def guchoku216(aa,turn=true) return !turn if aa.size == 0 aa.sort! return @dp[aa+[turn]] if @dp[aa+[turn]] aa.each_index{|i| ac = aa.clone ac[i]-=1 while ac[i] > 0 return @dp[aa+[turn]] = turn if (guchoku216(ac.clone,!turn) == turn) ac[i]-=1 end ac.delete(0) return @dp[aa+[turn]] = turn if (guchoku216(ac.clone,!turn) == turn) } return @dp[aa+[turn]] = !turn end def game(n) guchoku216(n.prime_division.map{|e|e[1]}) end n = gets.to_i puts guchoku216(gets.split.map(&:to_i).map{|e| e.prime_division.map{|e|e[1]}}.flatten!) ? 'white' : 'black'