https://www.acmicpc.net/problem/11650
import Foundation
struct Index {
var x: Int
var y: Int
}
let N = Int(readLine()!)!
var locations: [Index] = []
for _ in 0..<N {
let input = readLine()!.components(separatedBy: " ").map { Int($0)! }
let index = Index(x: input[0], y: input[1])
locations.append(index)
}
locations.sort {
if $0.x == $1.x {
return $0.y < $1.y
}
return $0.x < $1.x
}
locations.forEach {
print("\($0.x) \($0.y)")
}