#include <bits/stdc++.h>
using namespace std;
int N;
vector<pair<int, int>> p[100000];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int safe(int i, int j) {
  return (0 <= i && i < 100000) && (0 <= j && j < 100000);
}
void f(int i, int j, int cnt) {
  if (cnt == N) cout << "Yes";
  for (int k = 0; k < 4; k++)
    if (safe(i + dx[k], j + dy[k]) && p[cnt][0].first == i &&
        p[cnt][0].second == j)
      f(i + dx[k], j + dy[k], cnt + 1);
}
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    p[a].push_back(make_pair(b, c));
  }
  return 0;
}
