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>
int main(void)
{
	int n,m,i,j,q,a[100],b[100],c[100],d[100],s[1000],z[1000];
	scanf("%d",&n);
	m=n*(n-1)/2;
	for(i=1;i<=m;i++){
		scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
	}
	for(j=1;j<=n;j++){
		s[j]=0;
		z[j]+=1;
	}
	for(i=1;i<=m;i++){
		for(j=1;j<=n;j++){
			if(j==a[i]){
				if(c[i]>d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
			if(j==b[i]){
				if(c[i]<d[i]){
					s[j]+=3;
				}
				else if(c[i]==d[i]){
					s[j]+=1;
				}
			}
		}
	}
	for(j=1;j<=n;j++){
		for(q=1;q<=n;q++){
			if(s[j]<s[q]){
				z[j]++;
			}
	//	printf("i=%d q=%d\n",s[i],s[q]);
		}
		printf("%d\n",z[j]);
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> v(n,0);
    for(int i = 0; i < n*(n-1)/2; i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        a--,b--;
        if(c < d){//b
            v[b] += 3;
        }else if(c > d){//a
            v[a] += 3;
        }else{//draw
            v[a]++;
            v[b]++;
        }
    }
    int place = 1;
    vector<int> ans(n);
    for(int score = 3*n; score >= 0; score--){
        int cnt = 0;
        for(int i = 0; i < n; i++)if(v[i] == score){
            ans[i] = place;
            cnt++;
        }
        place += cnt;
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){

	int N;
	cin >> N;
	int score[N], rank[N];
	vector<int> log;
	for(int i = 0; i < N; i++){
		score[i] = 0;
		rank[i] = 0;
	}

	for(int i = 0; i < (N*(N-1))/2; i++){
		int point1, point2, team1, team2;
		cin >> team1 >> team2 >> point1 >> point2;
		if(point1 == point2){
			score[team1-1]++;
			score[team2-1]++;
		}else if(point1 < point2){
			score[team2-1] += 3;
		}else if(point1 > point2){
			score[team1-1] += 3;
		}
	}
	for(int i = 0; i < N; i++){
		log.push_back( score[i] );
	}
	sort(log.begin(), log.end(),greater<int>());

	for(int i = 0; i < N; i++){
		//if(i > 0 && log[i] == log[i-1]){continue;}
		for(int j = 0; j < N; j++){
			if(log[j] > score[i]){
				rank[i]++;
			}
		}
	}
	for(int i = 0; i < N; i++){
		cout << rank[i]+1 << endl;
	}

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void){
int n,i,j,a[5001],b[5001],c[5001],d[5001],p=0,team1[5001],result[5001],cnt=0,z=0;

cin>>n;

for(i=0;i<5001;i++){
	a[i]=0;
	b[i]=0;
	c[i]=0;
	d[i]=0;
	team1[i]=0;
	result[i]=1;
}

p=n*(n-1)/2;

for(i=1;i<=p;i++){
	cin>>a[i]>>b[i]>>c[i]>>d[i];

	if(c[i]>d[i]){
	team1[a[i]]=team1[a[i]]+3;
	}

	else if(c[i]<d[i]){
	team1[b[i]]=team1[b[i]]+3;
	}

	else{
	team1[a[i]]=team1[a[i]]+1;
	team1[b[i]]=team1[b[i]]+1;
	}
}

for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
        if(team1[i]<team1[j]){
            result[i]=result[i]+1;
        }
    }
}
for(i=1;i<=n;i++){
    printf("%d\n",result[i]);
}

return 0;
}

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

struct Team{int point,id;};
bool operator<(Team a,Team b){return a.point!=b.point?a.point>b.point:a.id<b.id;};

int main()
{
  int N,A,B,C,D;
  cin>>N;
  vector<Team>team(N);
  for(int i=0;i<N;i++){
    team[i].id=i;
  }
  for(int i=0;i<N*(N-1)/2;i++){
    cin>>A>>B>>C>>D;
    A--;
    B--;
    if(C>D){
      team[A].point+=3;
    }else if(C<D){
      team[B].point+=3;
    }else{
      team[A].point++;
      team[B].point++;
    }
  }

  sort(team.begin(),team.end());

  int r=1;
  vector<int>rank(N);
  rank[team[0].id]=r;
  for(int i=1;i<N;i++){
    r++;
    rank[team[i].id]=r;
    if(team[i].point==team[i-1].point)rank[team[i].id]=rank[team[i-1].id];
  }

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

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

class Game {
    int team1, team2, point1, point2;
    public:
        void set(int a, int b, int c, int d);
        void eval(int* score);
};

void Game::set(int a, int b, int c, int d) {
    team1 = a; team2 = b;
    point1 = c; point2 = d;
}

void Game::eval(int* score) {
    if (point1 < point2) score[team2 - 1] += 3;
    else if (point1 == point2) {
        score[team1 - 1]++;
        score[team2 - 1]++;
    } else score[team1 - 1] += 3;
}

int main() {
    int n; cin >> n;
    int score[n]; for (int j = 0; j < n; j++) score[j] = 0;

    const int time = n * (n - 1) / 2;
    Game games[time];
    for (int i = 0; i < time; i++) {
        int a, b, c, d; cin >> a >> b >> c >> d;
        games[i].set(a, b, c, d);
        games[i].eval(score);
    }

    int rank[n];
    for (int j = 0; j < n; j++) {
        int win = 0, even = 0;
        for (int jj = 0; jj < n; jj++)
            if (jj != j) {
                if (score[j] > score[jj]) win++;
                else if (score[j] == score[jj]) even++;
            }
        rank[j] = n - (win + even);
    }

    for (int j = 0; j < n; j++) cout << rank[j] << endl;
}

C++: #include <stdio.h>

int N, A[5000], B[5000], C[5000], D[5000];
int point[112][2], ans[112];

int main(void) {
	scanf("%d", &N);
	for (int i = 0; i < N*(N - 1) / 2; ++i) { scanf("%d%d%d%d", &A[i], &B[i], &C[i], &D[i]); }

	for (int i = 0; i < N*(N - 1) / 2; ++i) {
		if (C[i] < D[i]) { point[B[i] - 1][0] += 3; }
		if (C[i] > D[i]) { point[A[i] - 1][0] += 3; }
		if (C[i] == D[i]) { point[A[i] - 1][0]++; point[B[i] - 1][0]++; }
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (point[i][0] < point[j][0]) {
				ans[i]++;
			}
		}
		printf("%d\n", ans[i] + 1);
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
using namespace std;

int main(void){
	int n, nn, i, j;
	cin >> n;
	nn = n*(n-1)/2;
	int a[nn], b[nn], c[nn], d[nn], win[n], p[n], swap[1];
	for (i = 0; i < n; ++i){
		win[i] = 0;
	}
	for (i = 0; i < nn; ++i){
		scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
		if (c[i] > d[i]){
			win[a[i]-1] += 3;
		}else if (c[i] < d[i]){
			win[b[i]-1] += 3;
		}else{
			win[a[i]-1] += 1;
			win[b[i]-1] += 1;
		}
	}
	for (i = 0; i < n; ++i){
		p[i] = 1;
	}
	for (i = 0; i < n; ++i){
		for (j = 0; j < n; ++j){
			if (win[i] < win[j]){
				p[i]++;
			}
		}
		printf("%d\n", p[i]);
	}
	return 0;
}

C++: // 2014/12/10 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;

	int P[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){
			P[A-1] += 3;
		}
		else if(C<D){
			P[B-1] += 3;
		}
		else{
			P[A-1] += 1;
			P[B-1] += 1;
		}
	}

	for(int i=0; i<N; i++){
		int cnt = 0;

		for(int j=0; j<N; j++){
			if(P[i]<P[j]){
				cnt++;
			}
		}

		cout << cnt+1 << endl;
	}

	return 0;
}