package baekjoon.구현;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Main7568 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int N = Integer.parseInt(br.readLine());
Pair[] p = new Pair[N + 1];
for (int i = 0; i < N; i++) {
st = new StringTokenizer(br.readLine());
p[i] = new Pair(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < N; i++) {
int cnt = 0;
for (int j = 0; j < N; j++) {
if (i != j) {
if (p[i].y < p[j].y && p[i].x < p[j].x) {
cnt++;
}
}
}
sb.append(cnt + 1).append(' ');
}
System.out.println(sb);
}
private static class Pair {
int x, y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
}
알고리즘 & 자료구조/백준