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 ans[101];
int pts[101];
int spts[101];
int match;

void sort(int a[]);
void swap(int *a, int *b);

int main(void)
{
	int num;
	int n, m;
	int p1, p2;
	int i, j;
	int list[4500][4500];

	scanf("%d", &num);

	match = num * (num - 1) / 2;

	for (i = 0; i < match; i++){
		scanf("%d %d %d %d", &n, &m, &p1, &p2);

		if  (p1 < p2){
			list[n][m] = 0;
			list[m][n] = 3;
		}
		else if (p1 > p2){
			list[n][m] = 3;
			list[m][n] = 0;
		}
		else {
			list[n][m] = list[m][n] = 1;
		}
	}

	for (i = 1; i <= match; i++){
		for (j = 1; j <= match; j++){
			pts[i] += list[i][j];
		}
	}

	for (i = 0; i < match - 1; i++){
		spts[i] = pts[i];
	}

	sort(spts);

	for (i = 1; i < match - 1; i++){
		for (j = 0; j < num; j++){
			if (pts[i] == spts[j]){
				ans[i - 1] = j + 1;
				break;
			}
		}
	}

	for (i = 0; i < num; i++){
		printf("%d\n", ans[i]);
	}

	return (0);
}

void sort(int a[])
{
	int i, j;

	for (i = 0; i < match - 1; i++){
		for (j = i; j < match; j++){
			if (a[i] < a[j]){
				swap(&a[i], &a[j]);
			}
		}
	}
}

void swap(int *a, int * b)
{
	*a += *b;
	*b = *a - *b;
	*a -= *b;
}

C++: #include <stdio.h>
int main(){

  int n,team[100]={0},num[100],rank[100],ta,tb,sa,sb,i,j;
  int blank;
  
  scanf("%d",&n);

  for(i = 0; i < (n*n-n)/2; i++){

    scanf("%d %d %d %d",&ta,&tb,&sa,&sb);

    if(sa > sb) team[ta-1] += 3; 
    else if(sa < sb) team[tb-1] += 3;
    else{

      team[ta-1]++;
      team[tb-1]++;

    }

  }

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

  for(i = 0; i < n-1; i++){

    for(j = 0; j < n-1; j++){

      if(team[j] < team[j+1]){

        blank=team[j];
        team[j]=team[j+1];
        team[j+1]=blank;

        blank=num[j];
        num[j]=num[j+1];
        num[j+1]=blank;
        
      }

    }

  }

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

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

    rank[i]=i+1;
    if(team[i] == team[i-1]) rank[i]=rank[i-1];

  }

  //for(i = 0; i < n; i++) printf("%d\n",rank[i]);
  
  for(i = 0; i < n-1; i++){

    for(j = 0; j < n-1; j++){

      if(num[j] > num[j+1]){

        blank=num[j];
        num[j]=num[j+1];
        num[j+1]=blank;

        blank=rank[j];
        rank[j]=rank[j+1];
        rank[j+1]=blank;
        
      }

    }

  }
  //for(i = 0; i < n; i++) printf("%d\n",num[i]);
  for(i = 0; i < n; i++) printf("%d\n",rank[i]);

  return 0;

}

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

using namespace std;

int main()
{
	int score[100];
	int ans[100];
	vector<int> rnk[301];

	int n; cin >> n;

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

	for (int i = n - 1; i >= 0; --i) rnk[score[i]].push_back(i);

	int r = 1;

	for (int i = 300; i >= 0; --i) {
		int cnt = 0;
		while (rnk[i].size()) {
			ans[rnk[i].back()] = r;
			rnk[i].pop_back();
			cnt++;
		}
		r += cnt;
	}

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

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

using namespace std;

int main()
{
  int N; cin >> N;
  vector<int> team(N, 0);
  for(int i = 0; i < N*(N-1)/2; i++){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    if(c > d) team[a] += 3;
    else if(c < d) team[b] += 3;
    else team[a]++, team[b]++;
  }
  vector<int> score;
  for(int i = 0; i < N; i++) score.push_back(-team[i]);
  sort(score.begin(), score.end());
  for(int i = 0; i < N; i++){
    cout << lower_bound(score.begin(), score.end(), -team[i]) - score.begin() + 1 << endl;
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> score(n, 0);
    for(int i=0; i<n*(n-1)/2; i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        a--; b--;
        if(c > d){
            score[a] += 3;
        }else if(c < d){
            score[b] += 3;
        }else{
            score[a]++;
            score[b]++;
        }
    }

    vector<pair<int,int>> ord(n);
    for(int i=0; i<n; i++){
        ord[i] = {-score[i], i};
    }
    sort(ord.begin(), ord.end());
    vector<int> ans(n);
    int curr = 0;
    for(int i=0; i<n; i++){
        if(i!=0 and ord[i].first!=ord[i-1].first){
            curr = i;
        }
        ans[ord[i].second] = curr+1;
    }
    for(int i=0; i<n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int s[101],k[101];
int main()
{
	int i,j,n,m,a,b,a1,b1,q;
	cin>>n;
	for(i=1;i<=(n*(n-1))/2;i++)
	{
		cin>>a>>b>>a1>>b1;
		if(a1>b1)s[a]+=2;
		else if(b1>a1)s[b]+=2;
		else if(a1==b1)
		{
			s[a]++;
			s[b]++;
		}
	}
	for(i=1;i<=n;i++)
	{
		q=1;
		for(j=1;j<=n;j++)
		{
			if(s[i]<s[j])q++;	
		}
		k[i]=q;
	}
	for(i=1;i<=n;i++)cout<<k[i]<<endl;
	return 0;
}

C++: #include <stdio.h>
#define MAXN 105

typedef struct _pair {
  int id, score;
} pair;

int N;
pair arr[MAXN];
int rank[MAXN];

void bubleSort() {
  int i, j;
  pair p;
  for(i = 0; i < N; ++i) {
    for(j = 1; j < N-i; ++j) {
      if(arr[j-1].score < arr[j].score) {
        p = arr[j-1];
        arr[j-1] = arr[j];
        arr[j] = p;
      }
    }
  }
}

int main() {
  int i, j;
  int A, B, C, D;
  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    arr[i].id = i;
    arr[i].score = 0;
  }
  for(i = 0; i < N*(N-1)/2; ++i) {
    scanf("%d %d %d %d", &A, &B, &C, &D);
    --A; --B;
    if(C == D) {
      arr[A].score += 1;
      arr[B].score += 1;
    } else if(C > D) {
      arr[A].score += 3;
    } else if(C < D) {
      arr[B].score += 3;
    }
  }

  bubleSort();
  for(i = 0, j = 1; i < N; ++i) {
    if(i-1 >= 0 && arr[i].score == arr[i-1].score) {
    } else {
      j = i+1;
    }
    rank[arr[i].id] = j;
  }

  for(i = 0; i < N; ++i) {
    printf("%d\n", rank[i]);
  }

  return 0;
}

C++: #include<iostream>
#include<utility>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef pair<int,int> pii;

int main(){
	int n,a,b,ap,bp;
	cin>>n;
	int t[n];
	rep(i,n)t[i]=0;
	rep(i,n*(n-1)/2){
		cin>>a>>b>>ap>>bp;
		if(ap>bp)t[a-1]+=3;
		else if(ap<bp)t[b-1]+=3;
		else{
			t[a-1]++;t[b-1]++;
		}
	}
	pair<int,int> r[n],j[n];
	rep(i,n)r[i]=pair<int,int>(t[i],i+1);
	sort(r,r+n);
	for(int i=n-1,s=1,t=1;i>=0;i--){
		j[i]=pii(r[i].second,s);
		if(i==0)s++;
		t++;
		if(r[i].first!=r[i-1].first)s=t;
	}
	sort(j,j+n);
	rep(i,n)cout<<j[i].second<<endl;
	return 0;
}