require"prime"
z=Prime.take(20000)
def f i
(i==$u[i])?i:($u[i]=f($u[i]))
end
while(n=gets.to_i)>0
c=[a=0]*26
e=[nil]*26
$u=*0..25
n.times{
s=gets.chomp
a=s[0].ord-?a.ord
b=s[s.size-1].ord-?a.ord
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