require"prime"
z=Prime.take(20000)
def f i
i==$u[i]?i:$u[i]=f($u[i])
end
while 0<n=gets.to_i
c=[a=0]*26
e=[nil]*26
$u=*0..25
n.times{
s=gets.chomp.bytes
a=s[0]-97
b=s[-1]-97
c[a]+=1
c[b]-=1
e[a]=e[b]=1
$u[f a]=f b
}
puts (0..25).any?{|i|e[i]&&(c[i]!=0||f(a)!=f(i))}?"NG":"OK"
end