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>
using namespace std;
int main(){
	int n,a,b,c,d;
    cin >> n;

	int A[1000];
	int B[1000]; //n番目のチームの勝ち点


	for (int i=0; i<n; i++){
		A[i] = 0;
		B[i] = 0;
	}


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

	sort(A,A+n);
	reverse(A,A+n);

	int x = 0;

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			x++;
			if(B[i] == A[j]){
				cout << x << endl;
				x = 0;
				break;
			}
			
		}
	}

	return 0;
}

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

using namespace std;


int scores[101];
int ranks[101];

int main(){

    int n;
    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){
            scores[a]+=3;
        }
        else if(c<d){
            scores[b]+=3;
        }
        else{
            scores[b]+=1;
            scores[a]+=1;
        }
    }
    vector<pair<int,int> > vpii;
    for(int i=1;i<=n;i++){
        vpii.push_back(make_pair(-scores[i],i));
    }
    sort(vpii.begin(),vpii.end());
    int cnt=0;
    for(int i=0;i<vpii.size();i++){
        cnt++;
        if(i!=0&&vpii[i-1].first==vpii[i].first)ranks[vpii[i].second]=ranks[vpii[i-1].second];
        else ranks[vpii[i].second]=cnt;
    }
    for(int i=1;i<=n;i++)cout<<ranks[i]<<endl;

    return 0;
}

C++: //12-2 ????????????
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    int siai = N*(N-1)/2;
    int point[101] = {};
    for(int i=0; i<siai; i++){
        int A,B,C,D;
        cin >> A >> B >> C >> D;
        if(C==D){
            point[A] += 1;
            point[B] += 1;
        }
        else if(C>D){
            point[A] += 3;
        }
        else if(C<D){
            point[B] += 3;
        }
    }
    int rank[101] = {};
    int team = 1;
    for(int i=N*3; i>=0; i--){
        int now_team = 0;
        for(int l=1; l<N+1; l++){
            if(point[l] == i){
                rank[l-1] = team;
                now_team++;
            }
        }
        team += now_team;
    }
    for(int i=0; i<N; i++){
        cout << rank[i] << endl;
    }

    return 0;
}

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

int main() {
  int n,a,b,c,d;
  cin>>n;
  vector<pair<int,int> > points(n, make_pair(0,0));
  vector<int> rank(n, -1);
  for (int i=0; i<n; ~++i) points[i].second = i;
  for (int i=0; i<n*(n-1)/2; ++i) {
    cin>>a>>b>>c>>d; a--, b--;
    if (c>d) points[a].first += 3;
    else if (c<d) points[b].first += 3;
    else {
      points[a].first++, points[b].first++;
    }
  }

  sort(points.begin(), points.end(), greater<pair<int,int> >());
  int prev = -1, prank = 0;
  for (int i=0; i<n; ++i) {
    if (prev != points[i].first) prank = i+1;
    prev = points[i].first;
    rank[points[i].second] = prank;
  }
  for (int i=0; i<n; ++i) cout<<rank[i]<<endl;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
//NO SPECIFIED SPORTS!!!!
int p[100];
int q[100];
int main(){
    int a;
    scanf("%d",&a);
    for(int i=0;i<a*(a-1)/2;i++){
        int b,c,d,e;
        scanf("%d%d%d%d",&b,&c,&d,&e);
        b--;
        c--;
        if(d==e){
            p[b]--;
            p[c]--;
        }
        if(d<e){
            p[c]-=3;
        }
        if(e<d){
            p[b]-=3;
        }
    }
    for(int i=0;i<a;i++)q[i]=p[i];
    std::sort(p,p+a);
    for(int i=0;i<a;i++){
        printf("%d\n",lower_bound(p,p+a,q[i])-p+1);
    }
}

C++: #include <cstdio>
int main() {
	int p[100]={0},n;
	scanf("%d",&n);
	for(int i=0;i<n*(n-1)/2;i++) {
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		if(c>d)p[a-1]+=3;
		else if(c<d)p[b-1]+=3;
		else p[a-1]++,p[b-1]++;
	}
	for(int i=0;i<n;i++) {
		int rate=0;
		for(int j=0;j<n;j++)if(p[i]<p[j])rate++;
		printf("%d\n",rate+1);
	}
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

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

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};

int N;
int A[100];
int B[100];
int C[100];
int D[100];
int team[101];
int main()
{
  cin >>N;
  for(int i = 0;i < N*(N-1)/2;i++){
    cin>>A[i]>>B[i]>>C[i]>>D[i];
    if(C[i] >D[i]){
      team[A[i]] +=3;
    }else if(C[i] <D[i]){
      team[B[i]] +=3;
    }else{
      team[A[i]]++;
      team[B[i]]++;
    }   
  }
  int score[101] ={0};
  int k = 1;
    for(int n = 1;n <=N;n++){
      int tempmax = -1;
      for(int i =1;i <=N;i++){
	if(tempmax <team[i]){
	  tempmax = team[i];
	}
      }
    if(tempmax ==-1){
       for(int l = 1;l <=N;l++){
	  cout <<score[l]<<endl;
      }
       return 0;
    }
    bool flag =false;
    int kasan = 0;

    for(int j = 1;j <=N;j++){
    if(tempmax ==team[j]){
      if(flag =true){
	kasan++;
      }
      score[j] = k;
      team[j] =team[j]-(tempmax+1);
      flag = true;
    }
    }
    k+=kasan;
    }
  return 0;
}