require 'prime' g=Prime::TrialDivisionGenerator.new gets.to_i.times{p Prime.prime?(gets.to_i,g)?1:0}