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 <iostream>

using namespace std;

int main (void) {
  int G[101][101] = {0}, sum[101] = {0}, rank[101] = {0};
  int a, b, c, d;
  int n;

  cin >> n;

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

  for(int i = 1; i <= n; i++) {
    for(int j = 1; j <= n; j++) {
      if (i == j) continue;
      sum[i] += G[i][j];
    }
  }

  cout << sum[0] << " " << sum[1] << " " << sum[2] << " " << sum[3] << endl;

  int daburi = 1;

  // rankの出し方は俺が考えたアルゴリズムじゃない
  for(int i = 1; i <= n; i++) {
    rank[i] = 1;
    for(int j = 1; j <= n; j++) {
      if(sum[i] < sum[j]) rank[i]++;
    }
  }

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

  return 0;
}

C++: #include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int r[200];

int main() {
	int N;
	scanf("%d", &N);
	rep(i, N * (N - 1) / 2) {
		int a, b, c, d;
		scanf("%d %d %d %d", &a, &b, &c, &d);
		if(c == d) {
			++r[a]; ++r[b];
		}
		else if(c > d) r[a] += 3;
		else if(c < d) r[b] += 3;
	}
	FOR(i, 1, N + 1) {
		int cnt = 1;
		FOR(j, 1, N + 1) if(i != j && r[i] < r[j]) ++cnt;
		printf("%d\n", cnt);
	}
	return 0;
}

C++: #include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <map>
#define fr first
#define sc second
using namespace std;

int main(){
  typedef pair<int,int> P;
  int n,a,b,ap,bp,prev;
  P rank[101],tmp[101];
  memset(rank,0,sizeof(rank));
  cin >> n;
  for(int i=0;i<n*(n-1)/2;i++){
    cin >> a >> b >> ap >> bp;
    if(ap == bp){ rank[a].fr++; rank[b].fr++;}
    else if(ap > bp) rank[a].fr += 3;
    else rank[b].fr += 3;
  }
  copy(rank+1,rank+n+1,tmp);
  sort(rank+1,rank+n+1,greater<P>());
  prev = rank[1].fr; int r_p = 1;
  for(int i=1;i<=n;i++){
    if(prev == rank[i].fr) rank[i].sc = r_p;
    else{ rank[i].sc = i;  r_p = i; }
    prev = rank[i].fr;
  }
  for(int i=0;i<n;i++){
    for(int j=1;j<=n;j++){
      if(tmp[i].fr == rank[j].fr){ cout << rank[j].sc << endl; break;}
    }
  }
}

C++: #include<iostream>
using namespace std;
int main(){
    int team[100];
    for(int i=0;i<100;i++)team[i]=0;
    int n;
    cin>>n;
    int m=(n*(n-1))/2;
    for(int i=0;i<m;i++){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        if(c==d){
            team[a-1]++;
            team[b-1]++;
        }
        else if(c>d)team[a-1]+=3;
        else team[b-1]+=3;
    }

    int rnk[100],cnt=0;
    int ranking=1;
    while(cnt<n){
        int mxm=-100;
        int cpycnt=cnt;
        for(int j=0;j<n;j++){
            mxm=max(mxm,team[j]);
        }
        if(mxm==-1)break;
        for(int j=0;j<n;j++){
            if(mxm==team[j]){
                cnt++;
                team[j]=-1;
                rnk[j]=ranking;
            }
        }
        ranking+=cnt-cpycnt;
    }
    for(int i=0;i<n;i++)cout<<rnk[i]<<endl;

    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,a,b,pa,pb,point[100],rank[100];
	while(cin >> n,n){
		for(int i = 0;i < 100;++i){
			point[i] = 0;
			rank[i] = 1;
		}
		for(int i = 0;i < ((n*(n-1))/2);++i){
			cin >> a >> b >> pa >> pb;
			--a; --b;
			if(pa > pb) point[a] += 3;
			else if(pa < pb) point[b] += 3;
			else {
				++point[a];
				++point[b];
			}
		}
		for(int i = 0;i < n;++i){
			a = 1;
			pa = point[i];
			for(int j = 0;j < n;++j){
				if(pa < point[j]) ++a;
			}
			rank[i] = a;
		}
		for(int i = 0;i < n;++i){
			cout << rank[i] << endl;
		}
		
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int n,game,a,b,c,d;
typedef struct{
	int rank;
	int score;
}Team;
Team team[101];
int main(){
	cin >> n;
	game =n*(n-1)/2;
	for(int i=0;i<game;i++){
		cin >> a >>b >> c >>d;
		if(c>d){
			team[a].score+=3;
			team[b].score+=0;
		}else if(c==d){
			team[a].score+=1;
			team[b].score+=1;
		}else{
			team[a].score+=0;
			team[b].score+=3;
		}
	}
	for(int i=1;i<=n;i++){
		team[i].rank=1;
		for(int j=1;j<=n;j++){
			if(team[i].score<team[j].score)team[i].rank++;
		}
	}
	for(int i=1;i<=n;i++){
		cout << team[i].rank<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int n; cin>>n;
    vector<P> point(n);

    for(int i=0; i<n; i++) point[i].sc=i;

    for(int i=0; i<n*(n-1)/2; i++){
        int a, b, ap, bp; cin>>a>>b>>ap>>bp;
        a--, b--;
        if(ap>bp){
            point[a].fs+=3;
        }
        else if(ap<bp){
            point[b].fs+=3;
        }
        else{
            point[a].fs++;
            point[b].fs++;
        }
    }

    sort(point.begin(), point.end(), greater<P>());

    vector<int> ans(n);
    ans[point[0].sc]=1;
    for(int i=1; i<n; i++){
        if(point[i].fs==point[i-1].fs){
            ans[point[i].sc]=ans[point[i-1].sc];
        }
        else{
            ans[point[i].sc]=i+1;
        }
    }

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

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N * (N - 1) / 2), B(N * (N - 1) / 2), C(N * (N - 1) / 2),
      D(N * (N - 1) / 2);
  for (int i = 0; i < N * (N - 1) / 2; ++i)
    cin >> A[i] >> B[i] >> C[i] >> D[i];
  vector<int> s(N + 1);
  for (int i = 0; i < N * (N - 1) / 2; ++i)
    if (C[i] > D[i])
      s[A[i]] += 3;
    else if (C[i] == D[i])
      ++s[A[i]], ++s[B[i]];
    else
      s[B[i]] += 3;
  for (int i = 1; i <= N; ++i) {
    int r = 1;
    for (int j = 1; j <= N; ++j)
      if (s[i] < s[j])
        ++r;
    cout << r << endl;
  }
}