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>
#include<iostream>
#include<algorithm>
int p[101]={0},m[101]={0},l[101]={0};
using namespace std;
int main(){
int n,i,j,a,b,c,d;
cin>>n;
for(i=1;i<=n*(n-1)/2;i++){
	cin>>a>>b>>c>>d;
	if(c>d)m[a]+=3;
	else if(c<d)m[b]+=3;
	else {
		m[a]++;
		m[b]++;
	}
}
for(i=1;i<=n;i++)l[i]=m[i];
for(i=1;i<=n;i++){
	for(j=i+1;j<=n;j++){
		if(m[i]<m[j]){
			a=m[i];
			m[i]=m[j];
			m[j]=a;
		}
	}
}
for(i=1;i<=n;i++)cout<<l[i]<<' ';
cout<<endl;
for(i=1;i<=n;i++)cout<<m[i]<<' ';
cout<<endl;
for(i=1;i<=n;i++){
	for(j=1;j<=n;j++){
		if(m[i]==l[j]&&p[j]==0){
			p[j]=i;
			if(m[i]==m[i-1])p[i]=p[i-1];
		}
	}
}
for(i=1;i<=n;i++)cout<<p[i]<<endl;
return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int p[200];
int main(){
    int a;
    scanf("%d",&a);
    for(int i=0;i<(a*(a-1)/2);i++){
        int b,c,d,e;
        scanf("%d%d%d%d",&b,&c,&d,&e);
        b--;c--;
        if(d>e)p[b]+=3;
        else if(e>d)p[c]+=3;
        else {p[b]++;p[c]++;}
    }
    for(int i=0;i<a;i++){
        int num=1;
        for(int j=0;j<a;j++){
            if(p[j]>p[i])num++;
        }
        printf("%d\n",num);
    }
}

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

int main(){
    int n;
    int score[10000]={0},a,b,c,d;

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

    return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int ten[101],zyun[101];
	int n,a,b,c,d,i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)	{
		ten[i]=0;	zyun[i]=1;
	}
	for(i=0;i<n*(n-1)/2;i++)	{
		scanf("%d %d %d %d",&a,&b,&c,&d);
		if(c>d)	{
			ten[a]+=3;
		}
		else if(c<d){
			ten[b]+=3;
		}
		else {
			ten[a]++;	ten[b]++;
		}
	}
	for(i=1;i<n;i++)	{
		for(j=i+1;j<=n;j++)	{
			if(ten[i]<ten[j])	zyun[i]++;
			if(ten[i]>ten[j])	zyun[j]++;
		}
	}
	for(i=1;i<=n;i++)	{
		printf("%d\n",zyun[i]);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include <string.h>

using namespace std;
int main(){
	int n;
	int a,b,c,d,where=1;
	int points[105]={0};
	int rank[105];
	vector<int> conti;
	cin>>n;
	for(int i=0;i<n*(n-1)/2;i++){
		cin>>a>>b>>c>>d;
		a--,b--;
		if(c==d){
			points[a]++;
			points[b]++;
		}else if(c>d){
			points[a]+=3;
		}else{
			points[b]+=3;
		}
	}
	for(int i=0;i<n;i++){
		conti.push_back(points[i]);
		//cout<<points[i]<<endl;
	}
	sort(conti.begin(),conti.end());
	reverse(conti.begin(),conti.end());
	int checker=1,cnt;
  for(int i=0;i<n;){
		cnt=0;
		
		for(int j=0;j<n;j++){
			if(points[j]==conti[i]){
				cnt++;
				rank[j]=checker;
			}
		}
		i+=cnt;
		checker+=cnt;
	}
	for(int i=0;i<n;i++){
		cout<<rank[i]<<endl;
	}	
	
}

C++: #include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 100001
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

pair<int,int> a[101];
int b[101];
bool comp(pair<int,int> x, pair<int,int> y){
	return x.fi > y.fi;
}

int main(){
	int n, m, t[4], p, s = INF;
	scanf("%d", &n);
	m = (n*(n-1))/2;
	rrep(i,n)a[i].se = i;
	rep(i,m){
		rep(j,4)scanf("%d", &t[j]);
		if(t[2] > t[3])a[t[0]].fi += 3;
		if(t[2] < t[3])a[t[1]].fi += 3;
		if(t[2] == t[3])a[t[0]].fi++, a[t[1]].fi++;
	}
	sort(a+1, a+n+1, comp);
	for(int i = 1;i <= n;i++){
		if(s > a[i].fi){
			s = a[i].fi;
			p = i;
		}
		a[i].fi = p;
		b[a[i].se] = i;
	}
	rrep(i,n)printf("%d\n", a[b[i]].fi);
	return 0;
}

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

using namespace std;

int main(){
    int team,score[10000]={0},r;
    cin >>team;
    r=team*(team-1)/2;
    for(int i=0;i<r;i++){
        int a,b,c,d;
        cin >>a>>b>>c>>d;
        if(c>d)score[a]+=3;
        else if(c<d)score[b]+=3;
        else {
            score[a]++;
            score[b]++;
        }
    }
    int hi[10000]={0};
    for(int i=0;i<r;i++){
        hi[i]=score[i];
    }
    sort(hi+1, hi+r, greater<int>());
    for(int i=1;i<=team;i++){
        for(int j=0;j<r;j++){
            if(score[i]==hi[j]){
                cout<<j<<endl;
                score[i]=-1;
            }
        }
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };


int main()
{
	int p[128], n;
	cin >> n;
	int m = n * (n - 1) / 2;

	CLEAR(p, 0);
	while (m--)
	{
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		--a, --b;
		if (c > d)
			p[a] += 3;
		else if (c == d)
			++p[a], ++p[b];
		else
			p[b] += 3;
	}

	int rank[128];
	for (int r = 1; r <= n; )
	{
		int maxi = *max_element(p, p + n);
		int teams = 0;
		for (int i = 0; i < n; ++i)
		{
			if (maxi == p[i])
			{
				rank[i] = r;
				p[i] = -1;
				++teams;
			}
		}
		r += teams;
	}
	for (int i = 0; i < n; ++i)
		cout << rank[i] << endl;
}

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