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++: #define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;

static const double EPS = 1e-8;

int tx[] = {1,0};
int ty[] = {0,1};


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

	vector<P> points(n);
	int a,b,c,d;
	while(~scanf("%d %d %d %d",&a,&b,&c,&d)){
		points[a-1].second = a;
		points[b-1].second = b;
		if(c>d){
			points[a-1].first += 3;
			
		}
		else if(c<d){
			points[b-1].first += 3;
		}
		else{
			points[a-1].first += 1;
			points[b-1].first += 1;
		}
	}

	sort(points.begin(),points.end(),greater<P>());

	vector<int> rank(n);

	int maxV = INF;
	int idx=0;
	int tmp=1;
	for(int i=0;i<points.size();i++){
		if(maxV > points[i].first){
			idx+=tmp;
			tmp=1;
			maxV = points[i].first;
			rank[points[i].second-1] = idx;
		}
		else if(maxV == points[i].first){
			rank[points[i].second-1] = idx;
			tmp++;
		}
	}

	for(int i=0;i<rank.size();i++){
		printf("%d\n",rank[i]);
	}
}

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

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

int main() {
  int score[100];
  int N;
  cin >> N;
  fill(score,score+N,0);
  int num = N*(N-1)/2;
  for(int i = 0; i < num; ++i) {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    --A;--B;
    if(C > D) {
      score[A] += 3;
    } else if(C < D) {
      score[B] += 3;
    } else {
      ++score[A];
      ++score[B];
    }
  }
  vector<pair<int,int> > v;
  for(int i =0; i < N; ++i) {
    v.push_back(make_pair(score[i],i));
  }
  sort(v.begin(), v.end(), greater<pair<int,int> >());
  int s = 1;
  int output[100];
  output[v[0].second] = 1;
  for(int i = 1; i < v.size(); ++i) {
    if(v[i].first != v[i-1].first) s = i+1;
    output[v[i].second] = s;
  }
  for(int i = 0; i < N; ++i) {
    cout << output[i] << endl;
  }
  return 0;
}

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

cin>>n;

for(i=0;i<=n;i++){
	a[i]=0;
	b[i]=0;
	c[i]=0;
	d[i]=0;
	team1[i]=0;
	team2[i]=0;
	team3[i]=0;
	result[i]=0;
}

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++){
team2[i]=team1[i];
}
for(i=1;i<=n;i++){
    for(j=i+1;j<=n;j++){
	if(team1[i]<=team1[j]){
	z=team1[i];
	team1[i]=team1[j];
	team1[j]=z;
	}
    }
}
for(i=1;i<=n;i++){
	for(j=1;j<=n;j++){
		if(team1[i]==team2[j]){
		team3[j]=i;
		team2[j]=-1;
		}
	}
}
for(i=1;i<=n;i++){
printf("%d\n",team3[i]);
}
return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
typedef tuple<int, int, int> int3;

int main(void) {
  int n;
  cin >> n;

  int r[110][110] = {};
  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) r[a][b] = 1, r[b][a] = -1;
    else if (c < d) r[a][b] = -1, r[b][a] = 1;
  }

  vector<int> p(n, 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (j == i) continue;
      if (r[i][j] > 0) p[i] += 3;
      else if (r[i][j] == 0) p[i] += 1;
    }
  }

  vector<int> p2 = p;
  sort(p2.begin(), p2.end(), greater<int>());
  
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    mp[p2[i]] = lower_bound(p2.begin(), p2.end(), p2[i], greater<int>()) - p2.begin() + 1;
  }

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

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
	int n, a, b, c, d;
	int score[101];
	int pnt[101];
	fill_n(pnt, 101, 0);
	vector<pair<int, int> > v;
	cin >> n;
	for(int i = 0; i < n*(n-1)/2; i++){
		cin >> a >> b >> c >> d;
		if(c < d) pnt[b]++;
		else if(c > d) pnt[a]++;
		else pnt[b]++, pnt[a]++;
	}
	for(int i = 1; i <= n; i++){
		v.push_back(make_pair(pnt[i], i));
	}
	sort(v.begin(), v.end());
	int index = 0;
	int before = 0;
	int same = 0;
	for(int i = v.size() - 1; i >= 0; i--){
		if(v[i].first == before){
			same++;
			score[v[i].second] = index;
		}else{
			index += same + 1;
			score[v[i].second] = index;
			before = v[i].first;
		}
	}

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

	return 0;
}