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 <algorithm>
#include <cmath>

using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

typedef pair<int, int> pii;
int main(){
    int n;
    while(cin >> n && n){
        vector<pii> v(n);
        rep(i,n) v[i].second = i;
        int game = n * (n-1) / 2;

        rep(i,game){
            int a,b,c,d;
            cin >> a >> b >> c >> d;
            if(c>d) v[a-1].first += 3;
            else if(c < d) v[b-1].first += 3;
            else v[a-1].first++, v[b-1].first++;
        }

        sort(v.rbegin(), v.rend());
        int score = -1;
        int rank = 1;
        rep(i,n){
            if (v[i].first == score) v[i].first = rank;
            else {
                score=v[i].first;
                v[i].first=i+1;
                rank=i+1;
            }
        }
        sort(v.begin(), v.end(), [](pii l,pii r){
                return l.second < r.second;
            });
        rep(i,n)cout<<v[i].first<<endl;
    }
}

C++: #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){	
	int score[200],val,ctn[200];
	memset(score, 0, sizeof(score));
	memset(ctn, 0, sizeof(ctn));
	cin >> val;
	int a, b, c, d;
	for (int i = 0; i < (val*(val-1))/2; i++){
		cin >> a >> b >> c >> d;
		if (c < d)
			score[b-1] += 3;
		else if (c > d)
			score[a-1] += 3;
		else if (c == d){
			score[a-1]++;
			score[b-1]++;
		}
	}
	for (int i = 0; i < val; i++){
		for (int j = 0; j < val; j++){
			if (score[a] < score[b])
				ctn[a]++;
		}
	cout << ctn[a] << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	int N,n[100],cnt=1,A,B,C,D;
	cin>>N;
	for(int i=0;i<N*(N-1)/2;i++){
		cin>>A>>B>>C>>D;
		if(C==D){
			n[A]+=1;
			n[B]+=1;
		}
		if(C>D){
			n[A]+=3;
		}
		if(D>C){
			n[B]+=3;
		}
	}
	for(int i=1;i<=N;i++){
		cnt=1;
		for(int j=1;j<=N;j++){
			if(i!=j && n[i]<n[j]){
				cnt++;
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n,e=0,i,a,s,d,f,x[1000],w[1000],q[1000],j,o;
	scanf("%d",&n);
	e=n*(n-1)/2;
	for(i=0;i<e;i++){
		x[i]=0;
		w[i]=0;
		q[i]=0;
	}	
	for(i=0;i<e;i++){
		scanf("%d %d %d %d",&a,&s,&d,&f);
		if(d<f){
			x[s]+=3;
		}
		if(f<d){
			x[a]+=3;
		}	
		if(d==f){
			x[a]++;
			x[s]++;
		}
	}
	for(i=1;i<=n;i++){
		w[i]=x[i];
	}	
	o=0;
	for(i=1;i<=n-1;i++){
		for(j=i+1;j<=n;j++){
			if(x[i]<x[j]){
				o=x[j];
				x[j]=x[i];
				x[i]=o;
			}
		}
	}	
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(w[i]==x[j]){
				w[i]=j;
				break;
			}
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",w[i]);
	}	
	return 0;	
}

C++: #include <cstdio>
#include <cstring>

#define MAX_N 105

int N, A, B, C, D, S[MAX_N + 1];

int main()
{
	scanf("%d", &N);

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

		if (C > D) { S[A] += 3; }
		if (C < D) { S[B] += 3; }
		if (C == D) { S[A] += 1; S[B] += 1; }
	}

	int rank;

	for (int i = 1; i <= N; i++)
	{
		rank = 1;

		for (int j = 1; j <= N; j++)
		{
			if (S[i] < S[j]) { rank += 1; }
		}

		printf("%d\n", rank);
	}

	return 0;
}

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

int N;
int score[110];

int main() {
  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) {
      score[a-1]++;
      score[b-1]++;
    }
    else if (c > d) score[a-1] += 3;
    else            score[b-1] += 3;
  }
  vector<int> t;
  for (int i=0; i<N; i++) t.push_back(score[i]);
  sort(t.begin(), t.end());

  int x = 0;
  for (int i=0; i<N; i++) {
    cout << N - (upper_bound(t.begin(), t.end(), score[i]) - t.begin() - 1) << "\n";
  }
  return 0;
}

C++: #include<stdio.h>

int main(void){
  int i,j,n,siai;
  int a,b,x,y,t1,t2;
  int t[150][3];
  scanf("%d",&n);
  for(i=0;i<150;i++){
     t[i][0]=0;//勝ち点
     t[i][1]=i;//チーム番号
	 t[i][2]=0;//順位
  }
  siai=n*(n-1)/2;
  for(i=0;i<siai;i++){
     scanf("%d %d %d %d",&a,&b,&x,&y);
     if(x>y)t[a][0]+=3;
     else if(x<y)t[b][0]+=3;
     else if(x==y){
              t[a][0]++;
              t[b][0]++;
     }
	
  }
   
  for(i=1;i<n;i++)
    for(j=i+1;j<n+1;j++){
       if(t[i][0]>t[j][0]){
          t1=t[i][0];
          t[i][0]=t[j][0];
          t[j][0]=t1;
          
		  t2=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t2;
       }
    }
  t[1][2]=1;
  for(i=2;i<n+1;i++){
      t[i][2]=i;
	  if(t[i][0]==t[i-1][0]){t[i][2]=t[i-1][2];}
  }

  for(i=1;i<n;i++)
    for(j=i+1;j<n+1;j++){
       if(t[i][1]<t[j][1]){
          t1=t[i][1];
          t[i][1]=t[j][1];
          t[j][1]=t1;

		  t2=t[i][2];
          t[i][2]=t[j][2];
          t[j][2]=t2;
       }
    }
  for(i=1;i<n+1;i++){
     printf("%d\n",t[i][2]);
  }
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;

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

int main() {

	int N;
	vector<int> s(123),t;

	scanf("%d", &N);

	REP(i, N *(N - 1) / 2) {
		int A, B, C, D;
		scanf("%d %d %d %d", &A, &B, &C, &D);
		s[A-1] += (C > D) ? 3 : 0;
		s[B-1] += (C < D) ? 3 : 0;
		if (C == D) {
			s[A-1]++;
			s[B-1]++;
		}
	}

	t = s;
	sort(t.begin(), t.begin() + N);

	REP(i, N) {
		printf("%d\n", N - distance(t.begin(), upper_bound(t.begin(), t.begin() + N, s[i])) + 1);
	}

	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n, team[101] = { 0 }, name[100] , a, b, c, d, hoz, iya;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		name[i]=1;
	for (int i = 1; i <= n*(n - 1) / 2; i++)
	{
		cin >> a >> b >> c >> d;
		if (c > d)
			team[a] += 3;
		else if (c == d)
		{
			team[a]++;
			team[b]++;
		}
		else
			team[b] += 3;
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (team[i] < team[j])
			{
				name[i]++;

			}
			
		}
	}
	for (int i = 1; i <= n; i++)
		cout << name[i] << endl;
	return 0;
}