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():
 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()




########################################################################################################################
##################################################v
################################################################################
##########v####################v##############################v##########v

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()




########################################################################################################################
##################################################v
################################################################################
##########v####################v##############################v##########v

Python: n=int(input())
macthes=[[int(s)for s in input().split(" ")]for i in range(n*(n-1)//2)]
pts=[0 for i in range(n)]
for m in macthes:
    if m[2]>m[3]:pts[m[0]-1]+=3
    elif m[2]<m[3]:pts[m[1]-1]+=3
    else:
        pts[m[0]-1]+=1
        pts[m[1]-1]+=1
d={}
for pt in pts:
    if pt in d:d[pt]+=1
    else:d[pt]=1
ks=sorted(d.keys(),reverse=True)
ag=1
r={}
for k in ks:
    r[k]=ag
    ag+=d[k]
for pt in pts:
    print(r[pt])

Python: n = int(input())
R = {}
for i in range(n): R[i] = 0
for _ in range(n*(n-1)//2):
	a, b, c, d = map(int, input().split())
	if c>d:
		R[a-1] += 3
	elif c==d:
		R[a-1] += 1
		R[b-1] += 1
	else:
		R[b-1] += 3

rank, temp = 1, -1
ranks = []
R = sorted(R.items(), key=lambda x:-x[1])
#print(R)
for i in range(len(R)):
	if temp!=R[i][1]:
		rank = i+1
		ranks.append([R[i][0], i+1])
	else:
		ranks.append([R[i][0], rank])
	temp = R[i][1]

ranks = sorted(ranks)
for i in ranks:
	print(i[1])

Python: # AOJ 0566: Soccer
# Python3 2018.6.30 bal4u

n = int(input())
m = n*(n-1)>>1
team = [[0 for j in range(3)] for i in range(n)] #[id,win,lost]
for i in range(n): team[i][0] = i
for i in range(m):
	a, b, c, d = map(int, input().split())
	a, b = a-1, b-1
	if   c > d: team[a][1] += 3
	elif c < d: team[b][1] += 3
	else:
		team[a][1] += 1
		team[b][1] += 1
team.sort(key=lambda x:(-x[1],x[0]))
team[0][2] = 1
for i in range(1, n):
	if team[i][1] == team[i-1][1]: team[i][2] = team[i-1][2]
	else: team[i][2] = i+1
team.sort()
for i in range(n): print(team[i][2])

Python: def main():
	team_num  = int(input())
	match_num = int((team_num * (team_num - 1)) / 2)
	win_points = {}

	for i in range(team_num):
		win_points[i+1] = 0

	for i in range(match_num):
		match_result = input().split(" ")
		teamA_num    = int(match_result[0])
		teamB_num    = int(match_result[1])
		teamA_point  = int(match_result[2])
		teamB_point  = int(match_result[3])

		if teamA_point > teamB_point:
			# TeamA Win
			win_points[teamA_num] += 3
		elif teamA_point < teamB_point:
			# TeamB Win
			win_points[teamB_num] += 3
		else:
			# Draw
			win_points[teamA_num] += 1
			win_points[teamB_num] += 1

	win_points_sorted = sorted(win_points.items(), key=lambda x:x[1], reverse=True)

	pre_team_point = -1
	ranks = [0]*team_num
	rank = 0
	for i in range(len(win_points_sorted)):
		if win_points_sorted[i][1] != pre_team_point:
			rank = i+1
		ranks[win_points_sorted[i][0]-1] = rank
		pre_team_point = win_points_sorted[i][1]

	for i in ranks:
		print(i)


if __name__ == '__main__':
	main()

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: import copy

n = int(input())
game = n * (n-1) // 2

point = [0] * n
for _ in range(game):
    a, b, c, d = map(int, input().split())
    if c > d:
        point[a-1] += 3
    elif c < d:
        point[b-1] += 3
    else:
        point[a-1] += 1
        point[b-1] += 1

point_tmp = copy.deepcopy(point)
point_tmp.sort(reverse=True)

grade = [0] * n
for i, p in enumerate(point):
    grade[i] = point_tmp.index(p) + 1

for g in grade:
    print(g)

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()




########################################################################################################################
##################################################v
################################################################################
##########v####################v##############################v##########v

Python: n=int(input());p=[0]*n
for i in range(n*(n-1)//2):
    a,b,c,d=map(int,input().split())
    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)