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 <bits/stdc++.h>
using namespace std;
 
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;
 
#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
 
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
 
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
 
  int N;
  cin >> N;
  vector<PII> cnt(N);
  REP(i,N) cnt[i].SS = i;
  REP(i,N*(N-1)/2){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	--a;
	--b;
	if(c > d) cnt[a].FF += 3;
	else if(c < d) cnt[b].FF += 3;
	else{
	  cnt[a].FF++;
	  cnt[b].FF++;
	}
  }
  RSORT(cnt);
 
  VI ord(N);
  REP(i,N)
	if(i>0 && cnt[i].FF == cnt[i-1].FF)
	  ord[cnt[i].SS] = ord[cnt[i-1].SS];
	else
	  ord[cnt[i].SS] = i+1;
 
  REP(i,N) cout << ord[i] << endl;
 
  return 0;
}

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

int main()
{
	int n;
	vector<pair<int, int> > point;	// 得点, チーム番号
	vector<int> rank;
	
	scanf("%d", &n);
	
	point.resize(n);
	rank.resize(n);
	for(int i = 0; i < n; ++i)
		point[i].first = 0, point[i].second = i;
	
	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) point[a - 1].first += 3;
		else if(c < d) point[b - 1].first += 3;
		else point[a - 1].first += 1, point[b - 1].first += 1;
	}
	
	sort(point.begin(), point.end());
	int prev = point[n - 1].first, same = 0, order = 1;
	
	for(int i = n - 1; i >= 0; --i) {
		
		int score = point[i].first, team = point[i].second;
		if(prev == score) {
			++same;
		} else {
			prev = score;
			order += same;
			same = 1;
		}
		rank[team] = order;
	}
	
	for(int i = 0; i < n; ++i)
		printf("%d\n", rank[i]);
	
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<cstdlib>
using namespace std;

struct aaa {
  int ten;
  int num;
  int jun;
};

int main() {
  int a;
  cin >> a;
  vector<aaa> b(a);
  for(int i = 0; i < a; i++) {
    b[i].ten = 0;
    b[i].num = i;
  }
  int c, d, e, f;
  for(int i = 0; i < a * (a - 1) / 2; i++) {
    cin >> c >> d >> e >> f;
    if(e == f) {
      b[c - 1].ten++;
      b[d - 1].ten++;
    }else if(e < f) {
      b[d - 1].ten += 3;
    }else {
      b[c - 1].ten += 3;
    }
  }
  for(int i = 0; i < a; i++) {
    for(int j = 0; j < a - 1; j++) {
      if(b[j].ten < b[j + 1].ten) {
        swap(b[j], b[j + 1]);
      }
    }
  }
  int mai = 0, mae = -1;
  for(int i = 0; i < a; i++) {
    if(b[i].ten == mae) {
      mai++;
    }else {
      mai = 0;
      mae = b[i].ten;
    }
    b[i].jun = i - mai + 1;
  }
  for(int i = 0; i < a; i++) {
    for(int j = 0; j < a; j++) {
      if(b[j].num == i) {
        cout << b[j].jun << endl;
        break;
      }
    }
  }
}

C++: #include<stdio.h>
int main(void)
{
	int n,m,i,j,q,a[101],b[101],c[101],d[101],s[1001],z[1001];
	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 <cstring>
#include <algorithm>
using namespace std;
int main(){	
	int score[200],val,ctn[200];
	memset(score, 0, sizeof(score));
	fill(ctn,ctn + 200 , 1);

	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[i] < score[j])
				ctn[i]++;
		}
	cout << ctn[i] << endl;
	}
}

C++: #include<iostream>
#include<string>
 
using namespace std;
 
int main(){
    int n;
	int a[11000],b[11000],c[11000],d[11000];
	int t[11000],k[11000];
	cin>>n;
	for(int i=0;i<(n*(n-1))/2;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
		t[i]=0;
	}
	for(int i=0;i<(n*(n-1))/2;i++){
		if(c[i]>d[i])
			t[a[i]]+=3;
		if(c[i]<d[i])
			t[b[i]]+=3;
		if(c[i]==d[i]){
			t[a[i]]++;
			t[b[i]]++;
		}
	}
	int j=1;
	int h=0;
	for(int g=n*3;g>=0;g--){
		for(int i=1;i<n+1;i++){
			if(g==t[i]){
				k[i]=j;
				h++;
			}
		}
		j+=h;
		h=0;
    }
	for(int i=1;i<n+1;i++){
		cout<<k[i]<<endl;
	}
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	int p[100] = {};

	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]++;
			p[b - 1]++;
		}
	}
	int ans[100];
	for (int i = 0;i < n;i++) {
		int a = 0;
		for (int j = 0;j < n;j++) {
			if (p[i] < p[j])a++;
		}
		ans[i] = a + 1;
	}
	for (int i = 0;i < n;i++)cout << ans[i] << endl;
	return 0;
}