# coding: utf-8
line = gets
while input = gets
  ans = []
  input = input.split(" ").map!(&:to_i).sort
  ans.push(input[0] % 3,input[1] % 4,input[2] % 5)
  if ans.all? {|n| n == 0} ;puts "YES"
  else ;puts "NO"
  end
end

