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[101],b[101],c[101],d[101],s[1000],z[1000];
	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("i=%d q=%d\n",s[i],s[q]);
		}
		printf("%d\n",z[j]);
	}
	return 0;
}

C++: #include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;//チーム数
  int plate[n][3];//順位表
  for(int i=0; i<n; i++){
    plate[i][1] = 0;
    plate[i][0] = i;
    plate[i][2] =0;
  }
  for(int i=0; i<n*(n-1)/2; i++){
    int h,a,hp,ap;
    cin >> h;//ホーム
    cin >> a;//アウェイ
    cin >> hp;//ホームの得点
    cin >> ap;//アウェイの得点
    if (hp>ap){
      plate[h-1][1]+=3;
    }
    if (hp<ap){
      plate[a-1][1]+=3;
    }
    if (hp==ap){
      plate[h-1][1]++;
      plate[a-1][1]++;
    }
  }

  for(int j=0; j<n-1; j++){
    for(int i=n-1; i>j; i--){
      if(plate[i][1]>plate[i-1][1]){
        int b,d;
        b=plate[i-1][1];
        d=plate[i-1][0];
        plate[i-1][0]=plate[i][0];
        plate[i-1][1]=plate[i][1];
        plate[i][0]=d;
        plate[i][1]=b;
      }
    }
  }
  plate[0][2]=1;
  for(int i=1; i<n; i++){
    if (plate[i][1]!=plate[i-1][1]){
      plate[i][2]=i+1;
    }
    else{
      plate[i][2]=plate[i-1][2];
    }
  }
  for(int j=0; j<n-1; j++){
    for(int i=n-1; i>j; i--){
      if(plate[i][0]<plate[i-1][0]){
        int b,d;
        b=plate[i-1][2];
        d=plate[i-1][0];
        plate[i-1][0]=plate[i][0];
        plate[i-1][2]=plate[i][2];
        plate[i][0]=d;
        plate[i][2]=b;
      }
    }
  }
  for(int i=0; i<n; i++){
    cout << plate[i][2] <<endl;
  }
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;

struct str{
	int a, b, c;
};
str team[100];
int main(){
	int n, a, b, c, d, j;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		team[i].a = i;
	for (int i = 0; i < n*(n - 1) / 2; i++){
		scanf("%d%d%d%d", &a, &b, &c, &d);
		a--; b--;
		if (c - d)c>d ? team[a].b+=3 : team[b].b+=3;
		else{ team[a].b++; team[b].b++; }
	}
	sort(team, team + n, [](str a, str b){return a.b > b.b; });
	for (int i = 0; i < n; i++){
		j = i;
		while (j < n&&team[i].b == team[j].b){
			team[j].c = i + 1;
			j++;
		}
		i = j - 1;
	}
	sort(team, team + n, [](str a, str b){return a.a < b.a; });
	for (int i = 0; i < n; i++)
		printf("%d\n", team[i].c);
	return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){

  int n;

  cin >> n;

  vector<int> team(n+1,0);
  
  for(int i = 0;i < n*(n-1)/2;++i){
    int x,y;
    int px,py;

    cin >> x >> y >> px >> py;

    if(px > py){
      team[x] += 3;
    }
    else if(px < py){
      team[y] += 3;
    }
    else if(px == py){
      team[x]++;
      team[y]++;
    }
    
  }

  
  
  int max = (n-1)*3;
  int rank = 1;
  vector<int> team_rank(n+1);
  
  for(int i = max;i >= 0;--i){
    int cnt = 0;
    for(int j = 1;j <= n;++j){
      if(team[j] == i){
	team_rank[j] = rank;
	cnt++;
      }
    }
    rank += cnt;
  }

  for(int i = 1;i <= n;++i)
    cout << team_rank[i] << endl;
  
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
int n,i,j,a[101],b[101],c[101],d[101],p=0,team[101],team2[101],team3[101],result[101],cnt=0,z=0;

cin>>n;

for(i=0;i<=n;i++){
	a[i]=0;
	b[i]=0;
	c[i]=0;
	d[i]=0;
	team[i]=0;
	team2[i]=0;
	team3[i]=0;
	result[i]=0;
}

p=n*(n-1)/2;

for(i=1;i<=p;i++){
	cin>>a[i]>>b[i]>>c[i]>>d[i];

	if(c[i]>d[i]){
	team[a[i]]=team[a[i]]+3;
	}

	else if(c[i]<d[i]){
	team[b[i]]=team[b[i]]+3;
	}

	else{
	team[a[i]]=team[a[i]]+1;
	team[b[i]]=team[b[i]]+1;
	}


}
for(i=1;i<=n;i++){
team2[i]=team[i];
}
for(i=1;i<=n;i++){
    for(j=i+1;j<=n;j++){
	if(team[i]<=team[j]){
	z=team[i];
	team[i]=team[j];
	team[j]=z;
	}
    }
}
for(i=1;i<=n;i++){
	for(j=1;j<=n;j++){
		if(team[i]==team2[j]){
		team3[j]=i;
		team2[j]=-1;
		}
	}
}
for(i=1;i<=n;i++){
printf("%d\n",team3[i]);
}
return 0;
}

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

int score[100], ranking[100], check1[100], check2[100];

int main()
{
    int n; cin >> n;
    int len = n*(n-1)/2;

    for(int i=0;i < len;++i) {
        int a, b, c, d; cin >> a >> b >> c >> d;
        if (c > d) score[a-1] += 3;
        else if (d > c) score[b-1] += 3;
        else ++score[a-1], ++score[b-1];
    }

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

    sort(ranking, ranking+n, greater<int>());

    for(int i=0;i < n;++i) {
        for(int j=0;j < n;++j) {
            if (check1[i]) break;
            if (score[i] == ranking[j]) {
                if (ranking[j] == check2[j]) {
                    score[i] = j+1;
                    check1[i] = 1;
                    continue;
                }
                if (!check2[j]) score[i] = j+1;
                check1[i] = 1, check2[j] = ranking[j];
            }
        } 
    }

    for(int i=0;i < n;++i) printf("%d\n", score[i]);

}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
	int team[101]={0};
	int ans[101] = {0};
	int n;
	int a,b,c,d;
	cin >> n;
	for(int i = 0; i < n * (n - 1) / 2; i++){
        scanf("%d %d %d %d",&a,&b,&c,&d);
        if(c > d){
            team[a] += 3;
            //printf("team[%d]の勝ち\n",a);
            //printf("team[%d]に勝ち点3プラス,team[%d]に勝ち点0プラス\n",a,b);
        }
        else if(c < d){
            team[b] += 3;
            //printf("team[%d]の勝ち\n",b);
            //printf("team[%d]に勝ち点0プラス,team[%d]に勝ち点3プラス\n",a,b);
        }
        else{
            //printf("引き分けです\n");
            //printf("team[%d]に勝ち点1プラス,team[%d]に勝ち点1プラス\n",a,b);
            team[a]++,team[b]++;
        }
	}

	int cn = 1;
	for(int l = 1; l <= n; l++){
	    int mx = 0;
	    int cnt = 0;
        for(int i = 1; i <= n; i++){
            mx = max(mx,team[i]);
        }
        for(int j = 1; j <= n; j++){
            if(team[j] == mx){
                team[j] = -1;
                ans[j] = cn;
                cnt++;
            }
        }
        cn += cnt;
	}
	for(int i = 1; i <= n; i++) cout << ans[i] << endl;

	return 0;
}