Go: package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	"strings"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextLineInt() []int {
	arr := strings.Split(nextLine(), " ")
	var ret []int
	for _, v := range arr {
		x, _ := strconv.Atoi(v)
		ret = append(ret, x)
	}
	return ret
}

type Pair struct {
	First int
	Second int
}

type Pairs []Pair

func (s Pairs) Len() int {
	return len(s)
}

func (s Pairs) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s Pairs) Less(i, j int) bool {
	return s[i].First > s[j].First
}

func main() {
	var n int
	arr := nextLineInt()
	n = arr[0]
	result := []Pair{}
	for i := 0; i < n; i++ {
		result = append(result, Pair{0, i})
	}
	for i := 0; i < n * (n - 1) / 2; i++ {
		arr := nextLineInt()
		A := arr[0]
		B := arr[1]
		C := arr[2]
		D := arr[3]
		if C > D {
			result[A-1].First += 3
		} else if C < D {
			result[B-1].First += 3
		} else {
			result[A-1].First++
			result[B-1].First++
		}
	}
	sort.Sort(Pairs(result))
	var ans [111]int
	point := 1000000000
	top := 0
	for i, r := range result {
		// 前の人よりポイントが低い
		if point > r.First {
			top = i + 1
			point = r.First
		}
		ans[r.Second] = top
	}
	for i := 0; i < n; i++ {
		fmt.Println(ans[i])
	}
}

Python: def f():
 N=int(input())
 s=[0]*N
 for _ in[0]*(N*~-N//2):
  a,b,c,d=map(int,input().split())
  s[a-1]+=3*(c>d)+(c==d)
  s[b-1]+=3*(d>c)+(d==c)
 b=[[]for _ in[0]*N*3]
 for i in range(N):b[s[i]]+=[i]
 r=1
 for x in b[::-1]:
  for y in x:s[y]=r
  if x:r+=len(x)
 print(*s,sep='\n')
f()

Python: def f():
 from heapq import heappop, heappush
 N=int(input())
 r=[0]*N
 for _ in[0]*(N*~-N//2):
  a,b,c,d=map(int,input().split())
  r[a-1]+=3*(c>d)+(c==d)
  r[b-1]+=3*(d>c)+(d==c)
 b=[[]for _ in[0]*N*3]
 for i in range(N):b[r[i]]+=[i]
 pq = []
 for i, s in enumerate(r):heappush(pq,[-s,i])
 rank=1
 display_rank=1
 prev_score=float('inf')
 while pq:
  s,i=heappop(pq)
  if s!=prev_score:rank=display_rank
  r[i]=rank
  display_rank+=1
  prev_score=s
 print(*r,sep='\n')
f()

Python: t = int(input())
point_l = [0 for i in range(t)]
for i in range((t*(t-1))/2):
    input_line = input()
    tmp = [int(x) for x in input_line.rstrip().split(' ')]
    if tmp[2] > tmp[3]:
        point_l[tmp[0]-1] += 3
    elif tmp[3] > tmp[2]:
        point_l[tmp[1]-1] += 3
    elif tmp[2] == tmp[3]:
        point_l[tmp[0]-1] += 1
        point_l[tmp[1]-1] += 1

rank_l = [0 for i in range(t)]
rank = 1
for l in sorted(point_l, reverse=True):
    dup = point_l.count(l)
    for j in range(dup):
        rank_l[point_l.index(l)] += rank
        point_l[point_l.index(l)] = -1
    rank += dup

for l in rank_l:
    print(l)

Python: def f():
 N=int(input())
 s=[0]*N
 for _ in[0]*(N*~-N//2):
  a,b,c,d=map(int,input().split())
  s[a-1]+=3*(c>d)+(c==d)
  s[b-1]+=3*(d>c)+(d==c)
 b=[[]for _ in[0]*N*3]
 for i in range(N):b[s[i]]+=[i]
 r=1
 for x in b[::-1]:
  for y in x:s[y]=r
  if x:r+=len(x)
 print(*s,sep='\n')
f()

Python: N=int(input())
s=[0]*N
for _ in[0]*(N*~-N//2):
 a,b,c,d=map(int,input().split())
 s[a-1]+=3*(c>d)+(c==d)
 s[b-1]+=3*(d>c)+(d==c)
b=[[]for _ in[0]*N*3]
for i in range(N):
 b[s[i]]+=[i]
r=1
for x in b[::-1]:
 for y in x:
  s[y]=r
 if x:r+=len(x)
print(*s,sep='\n')

Python: n=int(input());s=[list(map(int,input().split())) for _ in range(int(n*(n-1)/2))];p=[0]*n
for a,b,c,d in s: 
    if c>d:p[a-1]+=3 
    elif c<d:p[b-1]+=3 
    else:p[a-1]+=1;p[b-1]+=1
r=sorted(p,reverse=True)
for q in p:print(r.index(q)+1)

Python: N=int(input())
s=[0]*N
for _ in[0]*(N*~-N//2):
 a,b,c,d=map(int,input().split())
 s[a-1]+=3*(c>d)+(c==d)
 s[b-1]+=3*(d>c)+(d==c)
b=[[]for _ in[0]*N*3]
for i in range(N):
 b[s[i]]+=[i]
r=1
for x in b[::-1]:
 for y in x:
  s[y]=r
 if x:r+=len(x)
print(*s,sep='\n')

Python: def main():
	number_of_team = int(input())
	#チーム数
	result_matrix = [list(map(int, input().split())) for l in range(int(number_of_team*(number_of_team-1)/2))]
	#入力される試合の結果
	points_of_team = [0 for l in range(number_of_team)]
	#勝ち点を保存するリスト
	
	
	#勝ち点の計算
	for low in result_matrix:
		if low[2] == low[3]:
			points_of_team[int(low[0])-1] += 1
			points_of_team[int(low[1])-1] += 1
		elif low[2] > low[3]:
			points_of_team[int(low[0])-1] += 3
		else:
			points_of_team[int(low[1])-1] += 3

	sort_list = sorted(points_of_team,reverse=True)
	result_list = [0 for i in range(number_of_team)]#出力用のリスト
	rank = 1
	pred = sort_list[0]
	for i in range(number_of_team):
		max_index = points_of_team.index(sort_list[i])
		if pred != sort_list[i]:
			pred = sort_list[i]
			rank = i+1			

		result_list[max_index] = rank
		points_of_team[max_index] = -1

	for i in range(number_of_team):
		print(result_list[i])
		
	

if __name__ == '__main__':
	main()

Python: n = int(input())
m = int(n * (n-1) / 2)
score = list(0 for i in range(n))
for i in range(m) :
    team1, team2, score1, score2 = map(int, input().split())
    if score1 == score2 :
        score[team1 - 1] += 1
        score[team2 - 1] += 1
    elif score1 > score2 :
        score[team1 - 1] += 3
    else :
        score[team2 - 1] += 3

sorted_score = sorted(score, reverse=True)
for i in range(n) :
    print(sorted_score.index(score[i])+1)

Python: def f():
 from heapq import heappop, heappush
 N=int(input())
 r=[0]*N
 for _ in[0]*(N*~-N//2):
  a,b,c,d=map(int,input().split())
  r[a-1]+=3*(c>d)+(c==d)
  r[b-1]+=3*(d>c)+(d==c)
 b=[[]for _ in[0]*N*3]
 for i in range(N):b[r[i]]+=[i]
 pq = []
 for i, s in enumerate(r):heappush(pq,[-s,i])
 rank=1
 display_rank=1
 prev_score=float('inf')
 while pq:
  s,i=heappop(pq)
  if s!=prev_score:rank=display_rank
  r[i]=rank
  display_rank+=1
  prev_score=s
 print(*r,sep='\n')
f()

Python: def f():
 from heapq import heappop, heappush
 N=int(input())
 r=[0]*N
 for _ in[0]*(N*~-N//2):
  a,b,c,d=map(int,input().split())
  r[a-1]+=3*(c>d)+(c==d)
  r[b-1]+=3*(d>c)+(d==c)
 b=[[]for _ in[0]*N*3]
 for i in range(N):b[r[i]]+=[i]
 pq = []
 for i, s in enumerate(r):heappush(pq,[-s,i])
 rank=1
 display_rank=1
 prev_score=float('inf')
 while pq:
  s,i=heappop(pq)
  if s!=prev_score:rank=display_rank
  r[i]=rank
  display_rank+=1
  prev_score=s
 print(*r,sep='\n')
f()

Python: #B
N = int(input())
ABCD = [list(map(int,input().split())) for i in range(N*(N-1)//2)]

point = [[0,i] for i in range(N)]

for abcd in ABCD:
    a,b,c,d = abcd
    if c > d:
        point[a-1][0]+=3
    elif c < d:
        point[b-1][0]+=3
    else:
        point[a-1][0]+=1
        point[b-1][0]+=1
        
rank = [0]*N
point.sort(reverse=True)

mae = 0
now = 0
for i in range(N):
    p = point[i][0]
    ind = point[i][1]
    if p != mae:
        mae = p
        now = i
        rank[ind] = now+1
    else:
        rank[ind] = now+1
        
for r in rank:
    print(r)

C++: #include<iostream>

using namespace std;

int main(){
  int n;
  cin >> n;

  int score[n];
  for(int i = 0; i < n; i++) score[i] = 0;

  for(int i = 0; i < (n * (n-1)/2); i++){
    int t1, t2, s1, s2;
    cin >> t1 >> t2 >> s1 >> s2;
    if(s1 > s2) score[t1 - 1] += 3;
    else if(s1 < s2) score[t2 - 1] += 3;
    else if(s1 == s2){score[t1 - 1]++; score[t2 - 1]++;}
  }

  int rank[n];
  for(int i = 0; i < n; i++) rank[i] = 1;

  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(score[i] < score[j]) rank[i]++;
    }
  }


  for(int i = 0; i < n; i++) cout << rank[i] << endl;
}