let input = require('fs').readFileSync('/dev/stdin', 'utf8'); const A = input.split('\n') .map(v => v.split(/\s/)) .filter((v, i) => i != 0); const t = arr => arr.map((col, i) => arr.map(row => row[i])); const COUNT = t(A) .map((v, i) => v.includes('nyanpass') && [...new Set(v)].length == 2 && i + 1) .filter(v => v); console.log(t(A)); console.log(COUNT.length == 1 ? COUNT[0] : -1);