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>

using namespace std;

int main(){

    int n_team;
    int n_paly;
    int team_a, team_b;
    int goal_a, goal_b;
    int i, j;
    int temp;

    cin >> n_team;
    n_paly = n_team * (n_team-1) / 2;

    int score[n_team+1] = {0};
    int rank[n_team+1] = {0};

    for(i=0; i<n_paly; i++){
        cin >> team_a >> team_b >> goal_a >>goal_b;

        if(goal_a > goal_b){
            score[team_a]+=3;
        } else if(goal_b > goal_a){
            score[team_b]+=3;
        } else if(goal_a == goal_b){
            score[team_a]++;
            score[team_b]++;
        }
    }

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

        for(j=1; j<=n_team; j++){
            if(score[i] < score[j]){
                rank[i]++;
            }
        }

    }

    for(i=1; i<=n_team; i++){
        cout << rank[i] << 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 <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<int,int>> score(n);
    vector<int> result(n);
    for (int i = 0; i < n; ++i) {
        score[i].second = i;
    }
    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) {
            ++score[a].first;
            ++score[b].first;
        } else if (c > d) {
            score[a].first += 3;
        } else {
            score[b].first += 3;
        }
    }
    sort(score.rbegin(), score.rend());
    result[score[0].second] = 1;
    for (int i = 1; i < n; ++i) {
        if (score[i].first == score[i - 1].first) {
            result[score[i].second] = result[score[i - 1].second];
        } else {
            result[score[i].second] = i + 1;
        }
    }
    for (int i = 0; i < n; ++i) {
        cout << result[i] << '\n';
    }
}

C++: #include<iostream>
using namespace std;
int main(){
  int tmp,n,bell,t1,t2,po1,po2,team[110]={0};
  cin >> n;
  bell=n;
  bell*=n-1;
  bell/=2;
  for(int i=0;i<bell;i++){
    cin >> t1 >> t2 >> po1 >> po2;
    if(po1>po2){
      team[t1]+=3;
    }
    else if(po2>po1){
      team[t2]+=3;
    }
    else{
      team[t1]++;
      team[t2]++;
    }
  }

  //勝ち点計算終了。


  int lank[110][2]={0};
  for(int i=0;i<n;i++){
    lank[i][0]=team[i];
    lank[i][1]=i;
  }

  for(int i=0;i<n-1;i++){
    for(int j=n-1;j>i;j--){
      if(lank[j][0]>lank[j-1][0]){
	tmp=lank[j][0];
	lank[j][0]=lank[j-1][0];
	lank[j-1][0]=tmp;
	tmp=lank[j][1];
	lank[j][1]=lank[j-1][1];
	lank[j-1][1]=tmp;
      }
    }
  }

  //順位付け。
  //  int lank_ans[110];
  int LANK=1,tame=1;
  for(int i=0;i<n;i++){
    tame=1;

    while(1){
      if(lank[i][0]==lank[i+1][0]){
	lank[i][0]=LANK;
	//lank[i+1][0]=LANK;
	i++;
	tame++;
      }
    }
    lank[i][0]=LANK
    LANK+=tame;
  }

  //元の並びに戻す。
  for(int i=0;i<n-1;i++){
    for(int j=n-1;j>i;j--){
      if(lank[j][1]<lank[j-1][1]){
	/*	tmp=lank_ans[j];
	lank_ans[j]=lank_ans[j-1];
	lank_ans[j-1]=tmp;*/

	tmp=lank[j][0];
	lank[j][0]=lank[j-1][0];
	lank[j-1][0]=tmp;
	tmp=lank[j][1];
	lank[j][1]=lank[j-1][1];
	lank[j-1][1]=tmp;
      }
    }
  }

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

  return (0);
}

C++: //
//  main.cpp

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


int main(){	
	int n;
	int team[3][10001];
	int point[3][10001];
	int gets[10001];
	for(int i = 0;i<3;i++)for(int j=0;j<10001;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 <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
class Team{
public:
  int p,n,rank;
  Team(int _p,int _n,int _rank):p(_p),n(_n),rank(_rank){
  }
  bool operator < (const Team &o)const{
    return p > o.p;
  }
};
vector<Team> v;
void solve(){

  
}
void show(){
  for(vector<Team>::iterator it=v.begin();it!=v.end();it++){
    cout<<(*it).n<<","<<(*it).p<<endl;
  }
}
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    v.push_back(Team(0,i,0));
  }
  for(int i=0;i<(n*(n-1))/2;i++){
    int a,b,ap,bp;
    cin>>a>>b>>ap>>bp;
    int aw=0;
    int bw=0;
    if(ap>bp) aw=3;
    
    else if(ap<bp) bw=3;
    else {
      aw=bw=1;
    }
    v[a-1].p+=aw;
    v[b-1].p+=bw;
  }
  sort(v.begin(),v.end());
  //  show();
  int i=0;
  int r[101];
  int point=-1;
  for(vector<Team>::iterator it=v.begin();it!=v.end();it++){
    if(point!=(*it).p)i++;
    point=(*it).p;
    r[(*it).n]=i;
  }
  for(int i=0;i<n;i++){
    cout<<r[i]<<endl;
  }
 
  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	int p[100];
	int r[100];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		p[i]=0;
		r[i]=1;
	}
	int a,b,c,d;
	for(int i=0;i<n*(n-1)/2;i++){
		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]+=1;
			p[b-1]+=1;
		}
	}

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

	for(int i=0;i<n;i++)printf("%d\n",r[i]);
	return 0;
}