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 <algorithm>
#include <utility>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
const int N=1e2+10;
int main(){
    int n,a,b,c,d,tot;
    pi val[N];
    scanf("%d",&n);
    for(int i=1;i<=n;i++)val[i]={0,i};
    tot=(n*(n-1))/2
    while(tot--){
        scanf("%d%d%d%d",&a,&b,&c,&d);
        if(c==d){
            val[a].F++;
            val[b].F++;
        }
        else if(c>d)val[a].F+=3;
        else val[b].F+=3;
    }
    
    sort(val+1,val+1+n);
    for(int i=1;i<=n;i++)printf("%d\n",val[i].S);
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
	int a;
	cin>>a;
	map<int,int>s;
	for(int b=0;b<a;b++){
		s.insert(pair<int,int>(b+1,0));
		}
	for(int b=0;b<a*(a-1)/2;b++){
         	int c,d,e,f;
         	cin>>c>>d>>e>>f;
         	if(e>f)s[c]+=3;
         	else if(f>e)s[d]+=3;
         	else {s[c]++;s[d]++;}
	}
	map<int,vector<int>>n;
	for(int h=1;h<a+1;h++){
		n[s[h]];
		n[s[h]].push_back(h);
		}
		int l=1;
	map<int,int>k;
	for(int b=0;b<a;b++){
		k.insert(pair<int,int>(b+1,0));
		}
		auto u=n.end();
		u--;
		for(;;u--){
		for(int o=0;o<u->second.size();o++){
			k[u->second[o]]=l;
			}
			l+=u->second.size();
			if(u==n.begin())break;
		}
		for(int y=1;y<a+1;y++)cout<<k[y]<<endl;
	}

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

struct Team{
	int index,score,rank;
	Team(){score=0;}
};

bool rank_ask(const Team &a,const Team &b){
	if(a.score>b.score)return true;
	return false;
}
bool index_ask(const Team &a,const Team &b){
	if(a.index<b.index)return true;
	return false;
}

int main(){
	int n;
	Team team[101];
	std::cin>>n;
	for(int i=0;i<n;i++)team[i].index=i;
	for(int i=0;i<(n*(n-1)/2);i++){
		int a,b,c,d;
		std::cin>>a>>b>>c>>d;
		if(c>d)team[a-1].score+=3;
		else if(c==d)team[a-1].score++,team[b-1].score++;
		else team[b-1].score+=3;
	}
	std::sort(team+0,team+n,rank_ask);
	for(int i=0,a;i<n;i++){
		a=i+1;
		team[i].rank=a;
		while(team[i].score==team[i+1].score)team[i+1].rank=a,i++;
	}
	std::sort(team+0,team+n,index_ask);
	for(int i=0;i<n;i++)std::cout<<team[i].rank<<std::endl;
	return 0;
}

C++: #include <iostream>
#include <map>
using namespace std;
#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
int main(){
  int N;
  while(cin>>N){
    int wins[101] = {};
    REP(i,N*(N-1)/2){
      int A,B,C,D; cin>>A>>B>>C>>D;
      A--; B--;
      if(C < D) swap(A, B);
      if(C == D){
        wins[A] += 1;
        wins[B] += 1;
      }else{
        wins[A] += 3;
      }
    }
    map<int, int> cnt;
    map<int, int> order;
    REP(i,N)cnt[-wins[i]] ++;
    int t = 1;
    FORIT(it, cnt){
      order[-it->first] = t;
      t += it->second;
    }
    REP(i,N){
      cout<<order[wins[i]]<<endl;
    }
  }
  return 0;
}

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

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] += 3;
		else if (c == d) {
			point[a]++;
			point[b]++;
		}
		else point[b] += 3;
	}
	for (int i = 1; i <= n; ++i) {
		int count = 1;
		for (int i2 = 1; i2 <= n; ++i2) {
			if (point[i] < point[i2]) { count++; }
		}
		cout << count << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
const int INF=-5;
int main(){
	int n,ten[107]={0},tenc[107]={0},ans[107]={0};
	cin>>n;
	for(int i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		if(c>d)ten[a]+=3;
		else if(c<d)ten[b]+=3;
		else ten[a]++,ten[b]++;
	}
	//for(int i=1;i<=n;i++)cout<<ten[i];int ans[107]={0};
		for(int i=1;i<=n;i++)tenc[i]=ten[i];
		
		for(int i=1;i<=n;i++){
			cout<<ans[0]<<ans[1]<<ans[2]<<ans[3]<<endl;
			int tmp=-1,jun=-1;
			for(int j=1;j<=n;j++){
				if(tmp<tenc[j])tmp=tenc[j],jun=j;
			}
			tenc[jun]=-1;
			ans[jun]=i;
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(ten[i]==ten[j])(ans[i]>ans[j])?ans[i]=ans[j]:ans[j]=ans[i];
			}
		}
	for(int i=1;i<=n;i++)cout<<ans[i]<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
// #define int long long
 
/* short */
#define pb push_back
#define print(x) cout << x << '\n'
 
/* REPmacro */
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
 
/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = INT_MAX;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}

signed main()
{
  ios::sync_with_stdio(false);
  int n;

  cin >> n;
  vi t(n + 1, 0); 
  REP(i, n * (n - 1) / 2){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (c < d) t[b] += 3;
    else if (c > d) t[a] += 3;
    else t[a]++, t[b]++;
  }
  
  REPS(i, 1, n + 1){
    int r = 1;
    REPS(j, 1, n + 1){
      if (t[i] < t[j]) r++;
    }
    print(r);
  }

  return (0);
}

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

C++: #include<stdio.h>
int main(){
	int n,a,b,c,d,i,i2,p[100],m[100],t,l,r[100],aaa;
	scanf("%d",&n);
	for(i=0;i<=n;i++){
		p[i]=0;
		m[i]=0;
	}
	while(m[1]<n-1||m[2]<n-1||m[3]<n-1||m[4]<n-1){
		scanf("%d%d",&a,&b);
		m[a]++;
		m[b]++;
		scanf("%d%d",&c,&d);
		if(c>d){
			p[a]+=3;
		}
		else if(c<d){
			p[b]+=3;
		}
		else{
			p[a]++;
			p[b]++;
		}
	}
	for(i=1;i<=n;i++){
		m[i]=i;
	}
	for(i=1;i<=n;i++){
		for(i2=1;i2<=n;i2++){
			if(p[i]>p[i2]){
				t=p[i];
				p[i]=p[i2];
				p[i2]=t;
				t=m[i];
				m[i]=m[i2];
				m[i2]=t;
			}
		}
	}
	/*for(i=1;i<=n;i++){
		printf("%d %d\n",m[i],p[i]);
	}*/
	l=1;
	aaa=0;
	for(i=1;i<=n;i++){
		r[m[i]]=l;
		if(p[i]==p[i+1]){
			aaa++;
		}
		else{
			l=l+aaa+1;
			aaa=0;
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",r[i]);
	}
}