#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;

inline int read () {
	int ret = 0, t = 1;
	char c = getchar();
	while ((c < '0' || c > '9') && c != '-') c = getchar();
	if (c == '-') t = -1, c = getchar();
	while (c >= '0' && c <= '9') ret = ret * 10 + c - '0', c = getchar();
	return ret * t;
}

const int MAXN = 200200;
int n, fa[MAXN][22]; vector <int> E[MAXN];
int dep[MAXN], wson[MAXN];
void dfs (int x, int f) {
	dep[x] = dep[f] + 1; fa[x][0] = f;
	for (auto i: E[x]) if (i != f) dfs(i, x);
}

int dis (int u, int v) {
	int ret = dep[u] + dep[v], i;
	if (dep[u] < dep[v]) swap(u, v);
	for (i = 20; i >= 0; i--) if (dep[fa[u][i]] >= dep[v]) u = fa[u][i];
	if (u == v) return ret - 2 * dep[u];
	for (i = 20; i >= 0; i--) if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
	u = fa[u][0]; return ret - 2 * dep[u];
}

int las = 0, ans[MAXN];
void calc (int x, int f) {
	ans[x] = ans[las] + dis(las, x); las = x;
	for (auto i: E[x]) if (i != f && i != wson[x]) calc(i, x);
	if (wson[x]) calc(wson[x], x);
}

int main () {
	n = read(); int i, j;
	for (i = 1; i < n; i++) {
		int u = read(), v = read();
		E[u].push_back(v), E[v].push_back(u);
	}
	dfs(1, 0);
	for (i = 1, j = 0; i <= n; i++) if (dep[j] < dep[i]) j = i;
	int rt = j; dfs(j, 0);
	for (i = 1, j = 0; i <= n; i++) if (dep[j] < dep[i]) j = i;
	for (i = j; i; i = fa[i][0]) wson[fa[i][0]] = i;
	for (i = 1; i <= 20; i++) for (j = 1; j <= n; j++) fa[j][i] = fa[fa[j][i - 1]][i - 1];
	calc(rt, 0);
	for (i = 1; i <= n; i++) printf("%d ", ans[i]);
	return 0;
}


// in case of multiple test cases and N=1e5 don't intialize arrays as global except for graph vector-array
// always check whether or not you are doing mod of a negative number
// always use 1LL instead of 1
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace __gnu_pbds;
using namespace std;

// using long doubles saves you from corner cases but is very time consuming
#define double        long double
#define int           long long
#define pb            push_back
#define pii           pair<int,int>
#define vi            vector<int>
#define vii           vector<pii>
#define mi            map<int,int>
#define mii           map<pii,int>
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
// just comment the line below in case of interactive problems
#define endl          "\n"
#define repp(i,a,b)   for(int i=a;i<b;i++)
#define rep(i,a,b)    for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)       cout << #x << "=" << x << endl
#define deb2(x, y)    cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)   cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v)    for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI            3.1415926535897932384626
#define F         first
#define S         second
#define mod       1000000007
#define clr(x,y)    memset(x, y, sizeof(x))
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define inp(arr, n)    repp(i, 0, n) cin >> arr[i]
#define outp(arr, n)    repp(i, 0, n) cout << arr[i] << " "

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x



void solve()
{
  int n;  cin >> n;
  int ans = 0;
  vector<pair<int, int> > points;

  while (n--) {
      int x, y;
      cin >> x >> y;
      points.pb({x, y});
  }

  int flag = 0;
  repp(i, 0, sz(points)){
      repp(j, 0, sz(points)){
          repp(k, 0, sz(points)){
              if(i != j and j != k and i != k){
                  int a = points[i].F * (points[j].S - points[k].S) +  points[j].F * (points[k].S - points[i].S) + points[k].F * (points[i].S - points[j].S); 
                  if(a == 0){
                      flag = 1;
                       break;
                    }
                  }
              }
          }
      }
  cout << (flag ? "Yes" : "No");
}

int32_t main()
{
  IOS;
  int T = 1;
// cin >> T;
  //sieve();
  // int numOfSetBits = __builtin_popcountll(n);
  //std::cout << std::fixed << std::setprecision(12);
  for (int i = 1; i <= T; i++)
  {
    //cout << "Case #" << i << ": ";
    solve();
  }
}