#include<bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
  	int lo = 1000000000, hi = 1;
  	vector<vector<int>> a(n, vector<int>(5));
  	for (int i = 0; i < n; i++) {
    	for (int j = 0; j < 5; j++) {
        	cin >> a[i][j];
          	lo = min(lo, a[i][j]);
          	hi = max(hi, a[i][j]);
        }
    }
  
  	int ans = lo;
  	while (lo <= hi) {
    	int mid = lo + (hi - lo) / 2;
      	
      	vector<int> check(32, 0);
      	for (int i = 0; i < n; i++) {
        	int index = 0;
          	for (int j = 0; j < 5; j++) {
            	if (a[i][j] >= mid) index += (1 << j);
            }
          	check[index]++;
        }
      
      	bool good = false;
      	for (int i = 0; i < 32 && !good; i++) {
          	if (!check[i]) continue;
          	check[i]--;
        	for (int j = i; j < 32 && !good; j++) {
              	if (!check[j]) continue;
              	check[j]--;
            	for (int k = j; k < 32 && !good; k++) {
                  	if (!check[k]) continue;
                  	check[k]--;
                  
                  	bool can = true;
                  	for (int p = 0; p < 5 && can; p++) {
                    	int mask = 1 << p;
                      	if (!(i & mask || j & mask || k & mask))
                          can = false;
                    }
                  	if (can)
                      good = true;
                  	check[k]++;
                }
              	check[j]++;
            }
          	check[i]++;
        }
      
      	if (good) {
          	ans = max(ans, mid);
        	lo = mid + 1;
        } else {
        	hi = mid - 1;
        }
    }
 	cout << ans;
}
/*
 * @Author: AsilenceBTF
 * @LastEditTime: 2020-11-02 19:30:56
 */
#include<bits/stdc++.h>
#define sz(x) int(x.size())
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
const int N = 105;
const double eps = 1e-8;
int x[N], y[N];
int sgn(double x){
    if(fabs(x) < eps) return 0;
    if(x < 0) return -1;
    return 1;
}
struct Point{
    double x, y;
    Point(double _x = 0, double _y = 0){
        x = _x, y = _y;
    }
    Point operator - (const Point &b)const{
        return Point(x - b.x, y - b.y);
    }
    double operator ^(const Point &b)const{
        return x * b.y - y * b.x;
    }
};
struct Line{
    Point s, e;
    Line(){}
    Line(Point _s, Point _e){
        s = _s;
        e = _e;
    }
    int relation(Point p){
        int c = sgn((p - s) ^ (e - s));
        if(c < 0) return 1;
        else if(c > 0) return 2;
        else return 3;
    }
};
int main(){
    int n, f = 0;
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> x[i] >> y[i];
    for(int i = 1; i <= n; ++i){
        for(int j = i + 1; j <= n; ++j){
            for(int k = j + 1; k <= n; ++k){
                Line t = Line(Point(x[i], y[i]), Point(x[j], y[j]));
                if(t.relation(Point(x[k], y[k])) == 3){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    // system("pause");
}