#include<stdio.h>
#include<map>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
P s[101];
int r[100];
int main(){
	int n;
	scanf("%d",&n);
	int i,j;
	for(i=0;i<n;i++)s[i]=P(0,i);
	for(i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
		a--;b--;
		if(c>d)s[a].first+=3;
		if(c<d)s[b].first+=3;
		if(c==d){
			s[a].first+=1;
			s[b].first+=1;
		}
	}
	s[n]=P(-1,-1);
	sort(s,s+n);
	reverse(s,s+n);
	int p=0;
	int pr=0;
	while(p<n){
		r[s[p].second]=pr;
		while(s[p].first==s[p+1].first){
			p++;
			r[s[p].second]=pr;
		}
		p++;
		pr=p;
	}
	for(i=0;i<n;i++)printf("%d\n",r[i]+1);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}





int main() {
  int n;
  cin >> n;
  ll x,a[n+1];
  cin >> x;
  rep (i,n){
    cin >> a[i];
  }
  int res = 0;
  sort (a,a+n);
  rep (i,n){
    if (x >= a[i]) {
      res ++;
      x -= a[i];
    }
    else break;
  }
  if (res == n && x) --res;
  cout << res << endl;
}