toI(s=readline()) = parse(Int,s) toVI(s=readline()) = parse.(Int,split(s)) rep(f,n) = [f() for _ in 1:n] @enum YN Yes=1 No=0 function main() t = toI() for _ in 1:t n = toI() xys = rep(split∘readline,n) solve(n,xys) |> YN |> println end end function solve(n,xys) sort!(xys) mx = 0 for (x,y) in xys if x == "a" if 'a' ∈ y return true else # y == "b...b" mx = max(mx,length(y)) end elseif 'a' ∉ x && length(x) ≤ mx # x == "b...b" if 'a' ∈ y return true else # y == "b...b" return true end end end return false end @static if endswith(@__FILE__, PROGRAM_FILE) main() end