#!/bin/ruby gets.to_i.times{ gets puts gets.chars.map(&:to_i).sum % 3 < 1 ? :Yes : :No }