sort응용 느낌
const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
let input = fs.readFileSync(filePath).toString().trim().split('\n');
let N = Number(input.shift());
let age = [];
for(let i=0; i < N; i++) {
let arr = [];
arr.push(Number(input[i].trim().split(' ')[0]));
arr.push(input[i].trim().split(' ')[1]);
age.push(arr);
}
let tmp = [];
age.sort(function (a,b) {
return a[0] - b[0];
})
console.log(age);
let answer = '';
age.forEach(e => {
answer += e[0] + ' ' + e[1] + '\n';
})
console.log(answer);
이차배열 sort를 하고 함