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>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main() {
    int n;
    while (cin >> n) {
        vector<int> ps(n);
        fill(ps.begin(), ps.end(), 0);
        for (int i = 0, size = n * (n - 1) / 2; i < size; i++) {
            int a, b, c, d;
            cin >> a >> b >> c >> d;
            a--; b--;
            if (c > d) {
                ps[a] += 3;
            } else if (c < d) {
                ps[b] += 3;
            } else {
                ps[a]++;
                ps[b]++;
            }
        }
        multimap<int, int, greater<int> > ts;
        for (int i = 0; i < n; i++) {
            ts.insert(make_pair(ps[i], i));
        }
        vector<int> rs(n);
        int c = 1;
        int p = -1;
        int rank = 0;
        for (multimap<int, int>::iterator it = ts.begin(); it != ts.end(); it++) {
            if (it->first == p) {
                rs[it->second] = rank;
                c++;
            } else {
                rank += c;
                rs[it->second] = rank;
                p = it->first;
                c = 1;
            }
        }
        for (int i = 0; i < n; i++) {
            cout << rs[i] << endl;
        }
    }
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
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<bits/stdc++.h>
using namespace std;

#define rep(i, n) for(int i=0; i<n; i++)
#define rev(i, n) for(int i=(n)-1; i>=0; i--)

int n;
int d[111];
int r[111];
int A, B, C, D;

int main(int argc, char *argv[])
{
  cin >> n;
  rep(_, n * (n - 1) / 2){
    cin >> A >> B >> C >> D;
    if(C > D){
      d[A - 1] += 3;
    }
    else if(C < D){
      d[B - 1] += 3;
    }
    else{
      d[A - 1] += 1;
      d[B - 1] += 1;
    }
  }

  vector<int> res[333];
  rep(i, 333) rep(j, n) if(d[j] == i) res[i].push_back(j);

  int p = 1;
  rev(i, 333) if(res[i].size()){
    rep(j, res[i].size()) r[res[i][j]] = p;
    p += res[i].size();
  }

  rep(i, n) cout << r[i] << endl;
  
  return 0;
}

C++: #include<iostream>
#include<string>
 
using namespace std;
 
int main(){
    int n;
	int a[100],b[100],c[100],d[100];
	int t[100],k[100];
	cin>>n;
	for(int i=0;i<(n*(n-1))/2;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		t[i]=0;
	}
	for(int i=0;i<(n*(n-1))/2;i++){
		if(c[i]>d[i])
			t[a[i]]+=3;
		if(c[i]<d[i])
			t[b[i]]+=3;
		if(c[i]==d[i]){
			t[a[i]]++;
			t[b[i]]++;
		}
	}
	int j=1;
	int h=0;
	for(int g=n*3;g>=0;g--){
		for(int i=1;i<n+1;i++){
			if(g==t[i]){
				k[i]=j;
				h++;
			}
		}
		j+=h;
		h=0;
    }
	for(int i=1;i<n+1;i++){
		cout<<k[i]<<endl;
	}
    return 0;
}

C++: #include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());???????????????
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

int main() {

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

	for (int i = 1; i <= n; ++i) {
		int ans = 1;
		for (int i2 = 1; i2 <= n; ++i2) {
			if (point[i] < point[i2]) { ans++; }
		}
		cout << ans << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int team1, team2, point1, point2;
int joinnum,ranking[100];
vector<int> rankpoint;

int main()
{
	cin >> joinnum;
	int teamwin[100];
	for (int i = 0; i < joinnum; i++)
	{
		teamwin[i] = 0;
	}
	for (int i = 0; i < joinnum * (joinnum - 1) / 2; i++)
	{
		cin >> team1 >> team2 >> point1 >> point2;
		if (point1 > point2)teamwin[team1-1] += 3;
		else if (point1 == point2)
		{
			teamwin[team1-1] += 1;
			teamwin[team2-1] += 1;
		}
		else if (point1 < point2)teamwin[team2-1] += 3;
	}
	for (int i = 0; i < joinnum; i++)
	{
		rankpoint.push_back(teamwin[i]);
	}
	sort(rankpoint.begin(), rankpoint.end());
	reverse(rankpoint.begin(), rankpoint.end());
	for (int i = 0; i < joinnum; i++)
	{
		if (i != 0 && rankpoint[i] == rankpoint[i - 1])continue;
		for (int j = 0; j < joinnum; j++)
		{
			if (rankpoint[i] == teamwin[j] && ranking[j]==0)ranking[j] = i + 1;
		}
	}
	for (int i = 0; i < joinnum; i++)
	{
		cout << ranking[i] << endl;
	}
	return 0;

}

C++: #include<stdio.h>
int main()
{
	int team[101][3]={0},suu,kazu[101]={0},l1,l2,sum[101]={0},sum1=0,zyui[101]={0},kai=1;
	scanf("%d",&suu);
	sum1=suu*(suu-1)/2;
	for(int i=1;i<sum1+1;i++){
		scanf("%d %d",&l1,&l2);
		scanf("%d %d",&kazu[l1],&kazu[l2]);
		if(kazu[l1]==kazu[l2]){
			team[l1][2]+=1;
			team[l2][2]+=1;
		}
		else if(kazu[l1]>kazu[l2]){
			team[l1][0]+=1;
			team[l2][1]+=1;
		}
		else if(kazu[l2]>kazu[l1]){
			team[l2][0]+=1;
			team[l1][1]+=1;
		}
	}
	for(int i=1;i<suu+1;i++){
		sum[i]=team[i][0]*3+team[i][2];
	}
	for(int i=1;i<suu+1;i++){
		for(int i1=1;i1<suu+1;i1++){
			if(i!=i1){
				if(sum[i]<sum[i1]){
					zyui[i]++;
				}
			}
		}
	}
	for(int i=1;i<suu+1;i++){
		printf("%d\n",zyui[i]+1);
	}
	return 0;
}