const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const inputs = input.trim().split('\n');
const adj = inputs.map((s) => s.split(' ').map(Number));

class Edge {
  constructor(dest, weight = 1) {
    this.dest = dest;
    this.weight = weight;
  }
}

class Node {
  constructor() {
    this.list = [];
  }
  addEdge(edge) {
    this.list.push(edge);
  }
  isOdd() {
    return !!(this.list.length % 2)
  }
}

class Graph {
  constructor() {
    this.map = new Map();
  }
  getNode(source, edge) {
    return this.map.has(source) ? this.map.get(source) : new Node();
  }
  addEdge(source, edge) {
    const node = this.getNode(source);
    node.addEdge(edge);
  }
  countOdd() {
    return Array.from(this.map.values()).reduce(node => node.isOdd() ? 1 : 0, 0);
  }
}

const graph = new Graph();
adj.forEach(([source, dest]) => {
  graph.addEdge(source, new Edge(dest));
  graph.addEdge(dest, new Edge(source));
});

const totalOdd = graph.countOdd();
let result = 'NG';
if (totalOdd === 0) {
  result = 'OK';
} else if (totalOdd == 1 && (graph.getNode(1).isOdd()) || (graph.getNode(2).isOdd())) {
  result = 'OK';
} else if (totalOdd == 2 && (graph.getNode(1).isOdd()) && (graph.getNode(2).isOdd())) {
  result = 'OK';
}
console.log(result);

