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])
	}
}

C++: #include<stdio.h>
int main(void)
{
	int n,m,i,j,q,a[5000],b[5000],c[5000],d[5000],s[500],z[500];
	scanf("%d",&n);
	m=n*(n-1)/2;
	for(i=1;i<=m;i++){
		scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
	}
	for(j=1;j<=n;j++){
		s[j]=0;
		z[j]+=1;
	}
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			if(j==a[i]){
				if(c[i]>d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
			if(j==b[i]){
				if(c[i]<d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
		}
	}
	for(j=1;j<=n;j++){
		for(q=1;q<=n;q++){
			if(s[j]<s[q]){
				z[j]++;
			}
		}
		printf("%d\n",z[j]);
	}
	return 0;
}

C++: #include<stdio.h>

int main(void){
  int i,j,n;
  int a,b,x,y,t1,t2;
  int t[150][3];
  scanf("%d",&n);
  for(i=0;i<150;i++){
     t[i][0]=0;//勝ち点
     t[i][1]=i;//チーム番号
	 t[i][2]=0;//順位
  }

  for(i=0;i<n*(n-1)/2;i++){
     scanf("%d %d %d %d",&a,&b,&x,&y);
     if(x>y)t[a][0]+=3;
     else if(x<y)t[b][0]+=3;
     else if(x==y){
              t[a][0]++;
              t[b][0]++;
     }
	
  }
   
  for(i=1;i<n;i++)
    for(j=i+1;j<n+1;j++){
       if(t[i][0]>t[j][0]){
          t1=t[i][0];
          t[i][0]=t[j][0];
          t[j][0]=t1;
          
		  t2=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t2;
       }
    }
  t[1][2]=1;
  for(i=2;i<n+1;i++){
      t[i][2]=i;
	  if(t[i][0]==t[i-1][0]){t[i][2]=t[i-1][2];}
  }

  for(i=1;i<n;i++)
    for(j=i+1;j<n+1;j++){
       if(t[i][1]<t[j][1]){
          t1=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t1;

		  t2=t[i][2];
          t[i][2]=t[j][2];
          t[j][2]=t2;
       }
    }
  for(i=1;i<n+1;i++){
     printf("%d\n",t[i][2]);
  }
  return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
  int t[110]={};
  int N;
  cin >> N;
  int a,b,c,d;
  //得点
  for(int i = 0; i < N*(N-1)/2; i++){
    cin >> a >> b >> c >> d;
    if(c > d) t[a-1] += 3;
    else if(c < d) t[b-1] += 3;
    else if(c == d){
      t[a-1]++;
      t[b-1]++;
    }
  }
  //順位
  int rank[110]={};
  for(int j = 1; j < N+1; j++){
    int max = -1,indx=0;
    for(int i = 0; i < N; i++){
      if(max < t[i]){
	max = t[i];
	indx = i;
      }
    } 
    rank[indx] = j;
    t[indx] = -1;
  }
  for(int i = 0; i < N; i++){
    cout << rank[i] << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int P[102],sortP[102],n,a,b,c,d;
	scanf("%d",&n);
	for(int i=0;i<102;i++)P[i]=1000;
	for(int i=0;i<(n*(n-1))/2;i++){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		if(c>d)P[a]-=3;
		if(c==d){P[a]--; P[b]--;}
		if(c<d)P[b]-=3;
	}
	for(int i=0;i<102;i++)sortP[i]=P[i];
	sort(sortP,sortP+102);
	for(int i=1;i<n+1;i++){
		for(int j=0;;j++){
			if(P[i]==sortP[j]){
				printf("%d\n",j+1);
				break;
			}
		}
	}
}

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

int main()
{	
	//サッカー

	int N;
	cin >> N;
	int P[100];
	for (int i = 0; i < 100; i++) {
		P[i] = 0;
	}
	for (int i = 0; i < N*(N - 1) / 2; i++) {
		int a, b,c,d;
		cin >> a >> b >> c >> d;
		if (c > d) 
			P[a] += 3;
		if (c == d) {
			P[a]++;
			P[b]++;
		}
		if (c < d)
			P[b] += 3;
	}
	int Q[100];
	for (int i = 0; i < N; i++) {
		Q[i] = P[i];
	}
	sort(Q, Q + 100);
	int Ans[100];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (P[i] == Q[j]) {
				Ans[i] = j+1;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cout << Ans[i] << endl;
	}

	//レシート
	/*
	int N;
	int ans[5];
	int a;
	int i = 0;
	while (true)
	{
		cin >> N;
		if (N == 0) break;
		for (int j = 0; j < 9; j++) {
			cin >> a;
			N -= a;
		}
		ans[i] = N;
		i++;
	}
	for (int k = 0; k < 5; k++)
		cout << ans[k] << endl;
	*/
	//コンテスト	
	/*
	int W[10], K[10];
	for (int i = 0; i < 10; i++) {
		cin >> W[i];
	}
	for (int i = 0; i < 10; i++) {
		cin >> K[i];
	}
	sort(W, W + 10);
	reverse(W, W + 10);
	sort(K, K + 10);
	reverse(K, K + 10);
	cout << W[0] + W[1] + W[2] << " " << K[0] + K[1] + K[2] << endl;
	*/
	//ポイントカード
	/*
	int N, M;
	cin >> N >> M;
	int a;
	int A[5000];
	int b = 0;
	int x = 0;
	for (int i = 0; i <  M; i++) {
		cin >> a;
		if (a < N) {
			A[x]=a;
			x++;
		}
		else
		{
			b++;
		} 
		cin >> a;
	}
	int sum = 0;
	if (b < M - 1) {
		sort(A, A+x);
		reverse(A, A+x);
		for (int i = 0; i < M - 1 - b; i++) {
			sum += N - A[i];
		}
	}
	cout << sum << endl;
	*/

	//合計時間
	/*
	int sum=0, n;
	for (int i = 0; i < 4; i++) {
	cin >> n;
	sum += n;
	}
	cout << sum / 60 << endl;
	cout << sum % 60 << endl;
	//平均点
	/*
	int P[5];
	int sum=0;
	for (int i = 0; i < 5; i++) {
	cin >> P[i];
	if (P[i] < 40) P[i] = 40;
	sum += P[i];
	}
	cout << sum / 5 << endl;
	*/
	//投票
	/*
	int N, M;
	cin >> N >> M;
	int A[1000], vote[1000];
	for (int i = 0; i < N; i++) {
	cin >> A[i];
	vote[i] = 0;
	}
	int b;
	for (int i = 0; i < M; i++) {
	cin >> b;
	for (int j = 0; j < N; j++) {
	if (A[j] <= b) {
	vote[j]++;
	break;
	}
	}
	}
	int temps = 0, ans;
	for (int i = 0; i < N; i++) {
	if (vote[i] > temps) {
	temps = vote[i];
	ans = i;
	}
	}
	cout << ans + 1 << endl;
	*/

	//2.すごろく	
	/*
	int n;
	cin >> n;
	int A, _A = 1;
	int k = 0;
	int A_count[100];
	A_count[0] = 1;
	for (int i = 0; i < n; i++)
	{
	cin >> A;
	if (A == 1)
	{
	if (A == _A)
	{
	A_count[k]++;
	}
	else
	{
	k++;
	A_count[k] = 2;
	}
	}
	_A = A;
	}
	sort(A_count, A_count + k + 1);
	cout << A_count[k] << endl;
	*/

	//タイムカード
	/*
	int t[2][3];
	int x[3][3];
	for (int n=0; n < 3; n++)
	{
	for (int i=0; i < 2; i++)
	for (int k=0; k < 3; k++)
	cin >> t[i][k];

	for (int m = 2; m >= 0; m--)
	{
	x[n][m] = t[1][m] - t[0][m];
	if (t[0][m] > t[1][m])
	{
	x[n][m] += 60;
	t[1][m - 1]--;
	}
	}
	}
	for (int n= 0; n < 3; n++)
	{
	cout << x[n][0] << ' ' << x[n][1] <<' '<< x[n][2] << endl;
	}
	*/



	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

bool Cmp(pii a,pii b){
  if(a.first>b.first){
    return true;
  }else{
    return false;
  }
}

int main(){
  int n;
  cin>>n;
  vector<pii>team;
  for(int j=0;j<n;j++) team.push_back(pii(0,j));
  for(int i=0;i<(n*(n-1))/2;i++){
    int ta,tb,sa,sb;
    cin>>ta>>tb>>sa>>sb;
    if(sa>sb){
      team[--ta].first+=3;
    }else if(sa<sb){
      team[--tb].first+=3;
    }else{
      team[--ta].first++;
      team[--tb].first++;
    }
  }
  sort(team.begin(),team.end(),Cmp);
  //for(pii a : team)cout <<"score :" << a.first << " team num: " <<a.second << endl;
  //cout << endl;
  int ans[n];
  for(int i=0;i<team.size();i++){
    int cnt=0;
      while(team[i].first==team[i-1-cnt].first)cnt++;
    ans[team[i].second]=i+1-cnt;
  }
  for(int i=0;i<n;i++){
    cout << ans[i] << endl; 
  }
 return 0;
}