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>
#include<math.h>
#include<algorithm>
#include<cctype>
#include<string.h>
#include <stdlib.h>

#define PI 3.1415926
void swap(int* x, int* y) {
	int a = *x;
	int b = *y;
	*x = b;
	*y = a;
}
int factorial(int n);
int sum(int n, int*);
int ave(int n, int*);
int min(int n, int*), min(int n, int m);
int max(int n, int*), max(int n, int m);

int main() {
	int N, X[200],a,b,c,d;
	for (int i = 1; i <= N*(N - 1) / 2; i++) {
		scanf("%d %d %d %d", &a, &b, &c, &d);
		if (c = d) {
			X[a]++;
			X[b]++;
		}
		else if (c < d) {
			X[b] += 3;
		}
		else {
			X[a] += 3;
		}
	}
	for (int i = 1; i <= N; i++) {
		printf("%d\n", X[i]);
	}
	return 0;
}

int factorial(int n) {
	if (n > 0) {
		return n * factorial(n - 1);
	}
	else {
		return 1;
	}
}
int sum(int n, int *all) {
	int total = 0;
	for (int i = 0; i < n; ++i) {
		total += all[i];
	}
	return total;
}
int ave(int n, int *all) {
	int total = 0;
	for (int i = 0; i<n; ++i) {
		total += all[i];
	}
	return total / n;
}
int min(int n, int *all) {

	int min = all[0];
	for (int i = 1; i < n; ++i) {
		if (all[0] > all[i]) {
			min = all[i];
		}
	}
	return min;
}
int max(int n, int *all) {
	int max = all[0];
	for (int i = 1; i<n; ++i) {
		if (all[0]<all[i]) {
			max = all[i];
		}
	}
	return max;
}
int max(int n, int m) {
	if (n >= m) {
		return n;
	}
	else {
		return m;
	}
}
int min(int n, int m) {
	if (n >= m) {
		return m;
	}
	else {
		return n;
	}
}

C++: #include <iostream>
int main(){

  int n,team[100]={0},num[100],rank[100],ta,tb,sa,sb,i,j;
  int blank;
  
  scanf("%d",&n);

  for(i = 0; i < (n*n-n)/2; i++){

    scanf("%d %d %d %d",&ta,&tb,&sa,&sb);

    if(sa > sb) team[ta-1] += 3; 
    else if(sa < sb) team[tb-1] += 3;
    else{

      team[ta-1]++;
      team[tb-1]++;

    }

  }

  for(i = 0; i < n; i++) num[i]=i;

  for(i = 0; i < n-1; i++){

    for(j = 0; j < n-1; j++){

      if(team[j] < team[j+1]){

        blank=team[j];
        team[j]=team[j+1];
        team[j+1]=blank;

        blank=num[j];
        num[j]=num[j+1];
        num[j+1]=blank;
        
      }

    }

  }

  // for(i = 0; i < n; i++) printf("%d\n",num[i]);

  rank[0]=1;
  for(i = 1; i < n; i++){

    rank[i]=i+1;
    if(team[i] == team[i-1]) rank[i]=rank[i-1];

  }

  //for(i = 0; i < n; i++) printf("%d\n",rank[i]);
  
  for(i = 0; i < n-1; i++){

    for(j = 0; j < n-1; j++){

      if(num[j] > num[j+1]){

        blank=num[j];
        num[j]=num[j+1];
        num[j+1]=blank;

        blank=rank[j];
        rank[j]=rank[j+1];
        rank[j+1]=blank;
        
      }

    }

  }
  //for(i = 0; i < n; i++) printf("%d\n",num[i]);
  for(i = 0; i < n; i++) printf("%d\n",rank[i]);

  return 0;

}

C++: //
//  main.cpp

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int main(){	
	int n;
	int team[3][101];
	int point[3][101];
	int gets[101];
	for(int i = 0;i<3;i++)for(int j=0;j<101;j++)gets[j] = team[i][j] = point[i][j]= 0;
	
	cin >> n;
	for(int i=0;i<n*(n-1)/2;i++){
		cin >> team[0][i] >> team[1][i] >> point[0][i] >> point[1][i];
	}
	
	for(int i=0;i<n*(n-1)/2;i++){
		if(point[0][i] > point[1][i]){
			gets[team[0][i]] += 3;
		}else if(point[0][i] < point[1][i]){
			gets[team[1][i]] += 3;
		}else{
			gets[team[0][i]] += 1;
			gets[team[1][i]] += 1;
		}
	}
	
	vector <pair<int,int> > vec;
	for(int i=1;i<=n;i++){
		vec.push_back(make_pair(gets[i],i));//?????°?????????
	}
	sort(vec.begin(),vec.end());
	int answer[101]={};
	int memo = -1;
	int count = 0;
	for(int i=n-1;i>=0;i--){
		if(memo == vec[i].first){
			count ++;
		}else{
			memo = vec[i].first;
			count = 0;
		}
		answer[vec[i].second] = n - i - count;
	}
	for(int i=1;i<=n;i++){
		cout << answer[i] << endl;
	}
	
	return 0;
}

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

int main(){
  int n,rank[100];
  pair<int,int> point[100];
  scanf("%d",&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[b-1].first += 3;
    }else if(c>d){
      point[a-1].first += 3;
    }else{
      point[a-1].first += 1;
      point[b-1].first += 1;
    }
  }
  sort(point,point+n);
  reverse(point,point+n);
  int r;
  for(int i=0;i<n;i++){
    int team = point[i].second;
    if(i>0&&point[i].first==point[i-1].first){
      rank[team] = r;
    }else{
      r = i+1;
      rank[team] = r;
    }
  }
  for(int i=0;i<n;i++) printf("%d\n",rank[i]);
  return 0;
}

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

using namespace std;

int main()
{
	int n;
	int score[100];
	int win[100];
	int gameteam1[10000];
	int gameteam2[10000];
	int t1score[10000];
	int t2score[10000];
	pair<pair<int, int>,pair<int,int>> sorter[100];
	pair<int, int> answer[100];

	for (int a = 0; a < 100; a++)
	{
		score[a] = 0;
		win[a] = 0;
	}

	for (int a = 0; a < 10000; a++)
	{
		gameteam1[a] = 0;
		gameteam2[a] = 0;
		t1score[a] = 0;
		t2score[a] = 0;
	}

	cin >> n;

	for (int a = 0; a < n*(n - 1) / 2; a++)
	{
		cin >> gameteam1[a] >> gameteam2[a] >> t1score[a] >> t2score[a];
	}

	for (int a = 0; a < n*(n - 1) / 2; a++)
	{
		if (t1score[a] == t2score[a])
		{
			score[gameteam1[a]-1]++;
			score[gameteam2[a]-1]++;
		}
		else
		{
			if (t1score[a] > t2score[a])
			{
				score[gameteam1[a]-1] += 3;
				win[gameteam1[a]-1]++;
			}
			else if (t1score[a] < t2score[a])
			{
				score[gameteam2[a]-1] += 3;
				win[gameteam2[a]-1]++;
			}
		}
	}

	for (int a = 0; a < n; a++)
	{
		sorter[a] = make_pair(make_pair(win[a], score[a]),make_pair(10000,a));
	}

	sort(sorter, sorter + n,greater<pair<pair<int,int>,pair<int,int>>>());

	sorter[0].second.first = 1;

	for (int a = 1; a < n; a++)
	{
		if (sorter[a].first.second == sorter[a - 1].first.second)
		{
			sorter[a].second.first = sorter[a - 1].second.first;
		}
		else
		{
			sorter[a].second.first = a + 1;
		}
	}

	for (int a = 0; a < n; a++)
	{
		answer[a] = make_pair(sorter[a].second.second, sorter[a].second.first);
	}

	sort(answer, answer + n);

	for (int a = 0; a < n; a++)
	{
		cout << answer[a].second << endl;
	}

	return 0;
}