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 N, i, p, q, j, flg;
int GET[101][101], PNT[101], Order[101];
int main(){
    cin >> N;
    for (i=1; i<=N; i++) { PNT[i] = 0; Order[i]=1;}
    for (p=1; p<=N; p++) {
        for (q=1; q<=N; q++) {
            GET[q][p] = 9999;
        }
    }
    for (i=1; i<=(N*(N-1)/2); i++) {
        cin >> p >> q;
        cin  >> GET[p][q] >> GET[q][p];
    }
    for (p=1; p<=N; p++) {
        for (q=p+1; q<=N; q++) {
            if(p == q) { continue;}
            if (GET[p][q] > GET[q][p]) {
               PNT[p] += 3;
            } else {
                if (GET[p][q] > GET[q][p]) {
                PNT[p] += 3;
                } else {
                    PNT[p] += 1; PNT[q] += 1;
                }
            }
        }
     }
     for (p=1; p<=N; p++) {
         for (q=1; q<=N; q++) {
             if(PNT[p]<PNT[q]){Order[p]++;}
         }
     }
     for (i=1; i<N; i++) {
         cout << Order[i] << endl;
     }
     return 0;
}

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

typedef pair<int,int> P;

struct great{
	bool operator()(const P& x, const P& y) const{
		return x.first > y.first;
	}
};

int main(){
	int n,a,b,c,d,rank[100],same = 0;
	vector<P> vec;
	cin >> n;
	for(int i = 0;i < n;i++) vec.push_back(make_pair(0,i));
	for(int i = 0;i < (n * (n - 1)) / 2;i++){
		cin >> a >> b >> c >> d;
		if(c < d) vec[b - 1].first += 3;
		else if(c > d) vec[a - 1].first += 3;
		else {
			vec[a - 1].first++;
			vec[b - 1].first++;
		}
	}
	sort(vec.begin(),vec.end(),great());
	rank[vec[0].second] = 1;
	for(int i = 1;i < n;i++){
		if(vec[i].first == vec[i - 1].first){
			if(same == 0) same = i;
			rank[vec[i].second] = same;
		}
		else{
			rank[vec[i].second] = i + 1;
			same = 0;
		}
	}
	for(int i = 0;i < n;i++) cout << rank[i] << endl;
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
typedef long long int ll;

int main(){
	int n;
	cin >> n;
	int cou[100]={0};
	for(int i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		if(c > d) cou[a]+=3;
		else if(c < d) cou[b]+=3;
		else {
			cou[a]++;
			cou[b]++;
		}
	}
	P score[100];
	for(int i=1;i<=n;i++){
		P p; p.first=cou[i]; p.second=i;
		score[i-1] = p;
	}
	sort(score,score+n,greater<P>() );
	int rank[100]={0};
	for(int i=0;i<n;i++){
		if(i!=0&&score[i].first==score[i-1].first){
			rank[score[i].second] = rank[score[i-1].second];
		}
		else rank[score[i].second] = i+1;
	}
	for(int i=1;i<=n;i++){
		cout << rank[i] << endl;
	}
}

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

int n, rnk[101];//not use 0;
pair<int, int> point[101];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++) point[i].second = i;
	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].first += 3;
		else if (c < d) point[b].first += 3;
		else point[a].first += 1, point[b].first += 1;
	}
	sort(point + 1, point + n + 1, greater<pair<int, int> >());
	int now, p = 100000;
	for (int i = 1; i <= n; i++){
		if (p != point[i].first) p = point[i].first, now = i;
		rnk[point[i].second] = now;
	}
	for (int i = 1; i <= n; i++) cout << rnk[i] << endl;
	return 0;
}

C++: #include<stdio.h>
int main() {
	int hideo = 0, ruio = 0, masatoy = 0, nagase = 0, a[101] = { 0 }, p[101] = { 0 };
	int temp = 0, max[101] = { 0 },sum=1,text=0;
	scanf("%d", &hideo);
	for (int i = 1; i <= hideo*(hideo - 1) / 2; i++) {
		scanf("%d %d %d %d", &a[1], &a[2], &a[3], &a[4]);
		if (a[3] > a[4]) {
			p[a[1]] += 3;
		}
		else if (a[4] > a[3]) {
			p[a[2]] += 3;
		}
		else {
			p[a[1]]++;
			p[a[2]]++;
		}
	}
	for (int i = 1; i <= hideo; i++) {
		for (int i = 1; i <= hideo; i++) {
			if (temp < p[i]) {
				temp = p[i];
			}
		}
		for (int i = 1; i <= hideo; i++) {
			if (temp == p[i]) {
				max[i] = sum;
				text++;
				p[i] = -1;
			}
		}
		sum += text;
		temp = 0;
		text = 0;
	}
	for (int i = 1; i <= hideo; i++) {
		printf("%d\n", max[i]);
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n;
	cin>>n;
	vi d(n);
	int f,l,sf,sl;
	rep(i,0,n*(n-1)/2){
		cin>>f>>l>>sf>>sl;
		f--;
		l--;
		if(sf<sl){
			d[l]+=3;
		}else if(sf>sl){
			d[f]+=3;
		}else{
			d[l]++;
			d[f]++;
		}
	}
	vi e=d;
	sort(all(e));
	rep(i,0,n){
		int res=upper_bound(all(e),d[i])-e.begin();
		o(n+1-res);
	}
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,m,a,b,c,d;
  cin>>n;
  vector<int> p(n+1,0),q(n+1,0);
  m=n*(n-1)/2;
  rep(i,m){
    cin>>a>>b>>c>>d;
    if(c==d){
      p[a]++;
      p[b]++;
    }
    else if(c==max(c,d))p[a]+=3;
    else if(d==max(c,d))p[b]+=3;
  }
  int ma=0,z=0,k=1,o=0;
  while(z!=n){
    rep(i,n+1){
      if(i!=0)ma=max(ma,p[i]);
    }
    rep(i,n+1){
      if(ma==p[i]){
	q[i]=k;
	p[i]=0;
	z++;
	o++;
      }
    }
    k+=o;
    ma=0;
    o=0;
  }
  rep(i,n+1){
    if(i!=0)cout<<q[i]<<endl;
  }
  return (0);
}