var fs = require('fs'),
    length = fs.fstatSync(process.stdin.fd).size,
    buffer = new Buffer(length),
    bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
    input = buffer.toString('utf8', 0, bytesRead).split('\n');


function solve(G, i, use, start) {
  if(use.every(function(n){return n === 0})) {
    return G[i][start] === 1;
  }
  var use2;
  for(var j=0;j<26;j++) {
    if(G[i][j] === 0) {
      continue;
    }
    if(use[j] === 0) {
      continue;
    }
    use2 = use.slice();
    use2[j] = 0;
    if(solve(G, j, use2, start)) {
      return true;
    }
  }
  return false;
}

!function () {
  var N,
    G,
    str,
    ch1, ch2,
    int, out,
    a = 'a'.charCodeAt(0),
    i,j;
  while(input[0]!=='0') {
    N = input.shift() - 0;
    G = [];
    iin = [];
    out = [];
    for(i=0;i<26;i++) {
      G[i] = [];
      iin[i] = out[i] = 0;
      for(j=0;j<26;j++) {
        G[i][j] = 0;
      }
    }
    for(i=0;i<N;i++) {
      str = input.shift();
      ch1 = str.charCodeAt(0) - a;
      ch2 = str.charCodeAt(str.length - 1) - a;
      G[ch1][ch2] = 1;
      iin[ch1]++;
      out[ch2]++;
    }

    for(i=0;i<26;i++) {
      if(iin[i] > 0) {
        j = i;
      }
      if(iin[i] !== out[i]) {
        break;
      }
    }
    iin[j] = 0;
    console.log(i === 26 && solve(G, j, iin, j) ? 'OK' : 'NG');
  }
}();