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 <functional>
#include <algorithm>
#include <utility>

using namespace std;

#define N_MAX 101

#define WIN  3
#define DRAW 1
#define LOSE 0

int results[N_MAX][N_MAX] = {0};

int main() {
    int N; cin >> N;
    int no_data = N * (N -1) / 2;
    for (int i = 0; i < no_data; i++) {
        int a, b, a_pt, b_pt;
        int res_a, res_b;
        cin >> a >> b >> a_pt >> b_pt;
        if (a_pt > b_pt) {
            res_a = WIN;
            res_b = LOSE;
        } else if (a_pt == b_pt) {
            res_a = DRAW;
            res_b = DRAW;
        } else {
            res_a = LOSE;
            res_b = WIN;
        }
        results[a][b] = res_a;
        results[b][a] = res_b;
    }

    pair<int, int> total_pt[N+1];
    for (int i = 1; i <= N; i++) {
        total_pt[i].second = i;
        total_pt[i].first = 0;
        for (int j = 1; j <= N; j++) {
            total_pt[i].first += results[i][j];
        }
    }

    int number[N+1];
    sort(total_pt+1, total_pt+N+1, greater<pair<int, int> >());
    int prev_pt = 100000;
    for (int i = 1; i <= N; i++) {
        if (prev_pt == total_pt[i].first) {
            number[total_pt[i].second] = number[total_pt[i-1].second];
        } else {
            number[total_pt[i].second] = i;
        }
        prev_pt = total_pt[i].first;
    }
    for (int i = 1; i <= N; i++) {
        cout << number[i] << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
#define REP(i, b, e) for ( int i = b; i < (int)e; i++ )
#define rep(i, n) REP(i, 0, n)
static const int MAX = 100;

main(){
  int N, s, t, ps, pt;
  int R[MAX];
  pair<int, int> S[MAX];
  cin >> N;
  rep(i, N) { S[i].first = 0; S[i].second = i; }
  rep(i, N*(N-1)/2){
    cin >> s >> t >> ps >> pt; s--; t--; // to 0 base
    if ( ps > pt ) S[s].first += 3;
    else if ( ps < pt ) S[t].first += 3;
    else { S[t].first++; S[s].first++; }
  }
  
  sort(S, S + N);
  reverse(S, S + N);

  int r = 1;
  R[S[0].second] = r;
  REP(i, 1, N){
    if ( S[i].first != S[i-1].first ) r = (i+1);
    R[S[i].second] = r;
  }
  
  rep(i, N) cout << R[i] << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;
int n;

const int INF = 1 << 29;

typedef pair<int,int> P;
vector<P> teams;
bool sortSecond(const P& p1, const P& p2)
{
	if(p1.second != p2.second) return p1.second < p2.second;
	if(p1.first != p2.first) return p1.first < p2.first;
	return false;
}

int main(void)
{
	while(cin >> n && n)
	{
		teams.resize(n);
		for (int i = 0; i < n; i++)
		{
			teams[i] = P(0, i);
		}
		for (int i = 0, leags = n * (n - 1) / 2; i < leags; i++)
		{
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			if(c == d)
			{
				teams[a - 1].first++;
				teams[b - 1].first++;
			}
			else if(c > d) teams[a - 1].first += 3;
			else teams[b - 1].first += 3;
		}
		sort(teams.begin(), teams.end(), greater<P>());
		int hikiwake = 0;
		for (int i = 0; i < n; i++)
		{
			int tmp = teams[i].first;
			teams[i].first = i + 1 - hikiwake;
			if(i + 1 < n && tmp == teams[i + 1].first)
			{
				hikiwake++;
			}
			else hikiwake = 0;
		}
		sort(teams.begin(), teams.end(), sortSecond);
		for (int i = 0; i < n; i++)
		{
			cout << teams[i].first << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c,d,n,lank=1;
  cin >> n;

  int p[n],P[n],number[n];
  for(int i=0;i<n;i++){
    p[i]=0;
    number[i]=i+1;
  }

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


  //順位付け
  for(int i = 0 ; i < n-1 ; i++ ){
    for(int j = n - 1 ; j > i ; j-- ){
      if(p[j] > p[j-1]){
	swap(p[j],p[j-1]);
	swap(number[j],number[j-1]);
      }
    }
  }

    //cout << lank << endl;
  int tmp = 0;
  for(int i=0;i<n;i++,lank++){
    if(i && p[i-1] == p[i]) tmp++;
    else tmp = 0 , lank = i + 1 ;
    //cout << lank - tmp << endl;
    P[i]=lank-tmp;
  }

  for(int i = 0 ; i < n-1 ; i++ ){
    for(int j = n - 1 ; j > i ; j-- ){
      if(number[j] < number[j-1]){
	swap(number[j],number[j-1]);
	swap(P[j],P[j-1]);
      }
    }
  }

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

C++: #include<iostream>

using namespace std;

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

int s[100][100], k[100], r[100];

int main() {
  int n;
  cin >> n;
  rep (i, n * (n - 1) / 2) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    s[a][b] = c > d ? 3 : c == d ? 1 : 0;
    s[b][a] = d > c ? 3 : c == d ? 1 : 0;
  }
  rep (i, n) rep (j, n) k[i] += s[i][j];
  int t = 1;
  for (int i = 3 * n; i >= 0; --i) {
    int tt = 0;
    rep (j, n) if (k[j] == i) {
      ++tt;
      r[j] = t;
    }
    t += tt;
  }
  rep (i, n) cout << r[i] << endl;
}

C++: #include<iostream>
using namespace std;
struct S{
	int a;
	int b;
	bool operator > (const S& s)const
	{
		if(a < s.a){
			return true;
		}
		return false;
	}
	bool operator > (const S& s)const
	{
		if(a > s.a){
			return true;
		}
		return false;
	}
};
#include<aigorithm>
int main()
{
	S st[101]={};
	int A,B,C,D,i,n;
	cin>>n;
	for(i=1;i<=n;i++){
		st[i].a=i;
	}
	m=n(n-1)/2;
	for(i=0;i<m;i++){
		cin>>A>>B>>C>>D;
		if(C>D){
			st.b[A]+=3;
		}
		else if(C<D){
			st.b[B]+=3;
		}
		else{
			st.b[B]++;
			st.b[A]++;
		}
	}
	sort(st.b,n);
	cout<<st[i].a
	return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,x[100][3],y[100],a,b,c,d,flg;
	int i,k;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		x[i][0]=0; x[i][1]=0; x[i][2]=0; y[i]=i;
	}
	for(i=0;i<n*(n-1)/2;i++){
		scanf("%d %d %d %d",&a,&b,&c,&d);
		a--; b--;
		if(c>d){
			x[a][0]++; x[b][1]++;
		}
		else if(c<d){
			x[a][1]++; x[b][0]++;
		}
		else{
			x[a][2]++; x[b][2]++;
		}

	}
	for(i=0;i<n;i++){
		x[i][0]=x[i][0]*3+x[i][2];
	}
	for(i=0;i<n-1;i++){
		for(k=i+1;k<n;k++){
			if(x[i][0]<x[k][0]){
				swap(x[i][0],x[k][0]); swap(y[i],y[k]);
			}
		}
	}
	k=1;
	for(i=0;i<n;i++){
		x[i][1]=k; k++;
		if(x[i][0]==x[i-1][0]) x[i][1]=x[i-1][1];
	}
	for(i=0;i<n-1;i++){
		for(k=i+1;k<n;k++){
			if(y[i]>y[k]){
				swap(y[i],y[k]); swap(x[i][1],x[k][1]); swap(x[i][0],x[k][0]);
			}
		}
	}
	for(i=0;i<n;i++) printf("%d\n",x[i][1]);
	return 0;
}