SP10506 PRENDON - Prendonians

Description

The ancient civilization of the Prendonians, who lived in Jutland from 5000 BC to 4500

Input Format

The first line consists of a single integer T (1 cases. Each test case begins with a line with only the integer N (1 of names, followed by N lines with 3 word (a-z lowercase only, each word not longer than 103 characters), the first word is garanteed to be unique.

Output Format

For each test case print YES if the names are all valid and part of a valid Prendonian family tree and are all related to each other, print NO otherwise.