#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
typedef long long int ll;
typedef long double ld;

const int inf = 10000;

struct Point {
  int x;
  int y;
};

struct Rect {
  Point start;
  Point end;
};

int main() {
  int n;
  cin >> n;
  vector<Point> ad(n);

  // input
  rep(i, n) {
    int _;  // 一旦面積は考えない
    cin >> ad[i].x >> ad[i].y;
    cin >> _;
  }

  // 最初に x 座標を決める
  // 次でy座標を決めるといい感じになる

  vector<Rect> ans(n);
  // calc
  rep(i, n) {
    ans[i].start.x = ad[i].x;
    ans[i].start.y = ad[i].y;
  }

  rep(i, n) {
    int c = inf;

    rep(j, n) {
      if (i == j) continue;

      if (ad[i].x <= ad[j].x) {
        c = min(c, ad[j].x);
      }
    }
    ans[i].end.x = (c == ad[i].x) ? ad[i].x + 1 : c;
  }

  rep(i, n) {
    int d = inf;
    bool isSameX = false;
    rep(j, n) {
      if (i == j) continue;
      if (ad[i].x == ad[j].x) {
        isSameX = true;
        break;
      }
    }
    if (!isSameX) {
      ans[i].start.y = 0;
    }

    rep(j, n) {
      if (i == j) continue;

      if ((ad[i].x <= ad[j].x && ad[j].x <= ans[i].end.x) &&
          (ad[i].y <= ad[j].y)) {
        d = min(d, ad[j].y);
      }
    }
    ans[i].end.y = (d == ad[i].y) ? ad[i].y + 1 : d;
  }

  // output
  rep(i, n) {
    int a = ans[i].start.x;
    int b = ans[i].start.y;
    int c = ans[i].end.x;
    int d = ans[i].end.y;
    printf("%d %d %d %d\n", a, b, c, d);
  }
}

#include "bits/stdc++.h"
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds; 
using namespace std;
 #define int long long int
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi vector <int>
#define ff first
#define ss second
#define vp vector <pair<int,int>>
#define vpp vector <pair<int,pair<int,int>>>
#define seti set<int>
#define setbit(x) __builtin_popcountll(x)
#define sov(v) accumulate(all(v),0)
#define fs(it,a) for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pqmax priority_queue <int,vector <int>> 
#define pqmin priority_queue <int,vector <int>,greater<int>> 
#define dq deque <int>
#define umi unordered_map<int,int>
#define ums unordered_map<string,int>
#define sp(x,y) fixed << setprecision(y) << x
#define out(r,x) cout<<"Case #"<<r<<": "<<x<<ee;
#define all(x) x.begin(),x.end()
#define f(x,y,z) for(x=y;x<z;x++)
#define si size()
#define countdigit(x) floor(log10(x) +1)
#define M 1000000007
#define Z 998244353 
#define fill(arr,x) memset(arr,x,sizeof(arr))
//Use (k%M+m)%m always where k is any no
#define PI 3.1415926535
#define lcm(a,b)  a*b/(__gcd(a,b))
// typedef tree<int, null_type, less<int>, rb_tree_tag, 
// tree_order_statistics_node_update> pdbs; 
// // null for set,mapped_type for map; 
// //less for assending greater for descending
//ceil(a/b)=(a+b-1)/b
// v.si-1 can never be negative
#define ghadi() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();
#define ee "\n"
#define re return 
 
 
//Author Rahul Sannigrahi
 
vector<int> take(int n)
{
    int i,j;
    vi v;
    f(i,0,n)
    {
        cin>>j;
        v.pb(j);
    }
    return v;
}
 
int power(int x,int y)
{
    int res=1;
    
    while(y>0)
    {
       if(y&1)
       res=((res%M)*(x%M))%M;
       
       y=y>>1;
       x=((x%M)*(x%M))%M;
    }
    re res;
} 
 
bool sortinrev(const pair<int,int> &a,  //desc of vp
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
}


 
 
 
void show(vector<int>v)
{
    int i;
    for(i=0;i<v.si;i++)
    {
     cout<<v[i]<<" ";   
    }
    cout<<ee;
}

 
int decode()
{
int i,j,k,l,n,x,y;
cin>>x>>y;
if(x+1==y)
{
    cout<<__gcd(x,y)<<ee;
    re 0;
}


int ans=1;
f(i,1,y+1)
{
    if((y/i)*i>=x and (y/i)*i<=y and (y/i-1)*i>=x and (y/i-1)*i<=y)
    ans=max(ans,i);
}
cout<<ans<<ee;
   re 0;
}
 
int32_t main()
{
    IOS
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    //  freopen("output.txt","w",stdout);
    // #endif 
    
    int t=1;
      //cin>>t;
    while(t--)
    decode();
    return 0;
}