#include<iostream>
using namespace std;
#include<bits/stdc++.h>
#define INF 1LL<<40
#define N 500100
long long a[N],b[N],c[N],d[N],e[N],f[N],g[N],h[N];
int main()
{
 long long n;
 cin>>n;
 for(long long i=0;i<n;i++)
 {
  cin>>a[i]>>c[i]>>b[i]>>d[i];
  e[i]=a[i];
  f[i]=b[i];
  g[i]=c[i];
  h[i]=d[i];
 }
 sort(a,a+n);
 sort(b,b+n);
 sort(c,c+n);
 sort(d,d+n);
 long long p,q,r,s;
 for(long long i=0;i<n;i++)
 {
  p=a[n-1];
  q=b[0];
  r=c[n-1];
  s=d[0];
  if(e[i]==p)
  {
   p=a[n-2];
  }
 if(f[i]==q)
  {
   q=b[1];
  }
  if(g[i]==r)
  {
   r=c[n-2];
  }
  if(h[i]==s)
  {
   s=d[1];
  }
  if(p<=q && r<=s)
  {
    cout<<p<<" "<<r/2;
    break;
  }
 }
}


#include<bits/stdc++.h>

using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/

#define ull            unsigned long long

#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second

#define what_is(x)     cerr << #x << " is " << x << endl;

///*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout << endl ;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
int ini()
{
    int x;
    scanf("%d",&x);
    return x;
}
long long inl()
{
    long long x;
    scanf("%lld",&x);
    return x;
}

const int N = (int) 1e6 + 5;
const int inf = (int) 1e9 + 7;
const double pi=2* acos(0.0);

pii ll[N],ur[N];
int pllx[N],plly[N],purx[N],pury[N],sllx[N],slly[N],surx[N],sury[N];
int main()
{
   int n=ini();

   for(int i=1;i<=n;i++){
      int x,y;
      cin>>x>>y;
      ll[i]={x,y};
      cin>>x>>y;
      ur[i]={x,y};
   }
   for(int i=0;i<=n+1;i++){
    pllx[i]=-inf;
    plly[i]=-inf;
    purx[i]=inf;
    pury[i]=inf;
    sllx[i]=-inf;
    slly[i]=-inf;
    surx[i]=inf;
    sury[i]=inf;
   }
   int i;
   for(i=1;i<=n;i++){
     pllx[i]=max(ll[i].ff,pllx[i-1]);
     plly[i]=max(ll[i].ss,plly[i-1]);
     purx[i]=min(ur[i].ff,purx[i-1]);
     pury[i]=min(ur[i].ss,pury[i-1]);
   }
   for(i=n;i>=1;i--){
     sllx[i]=max(ll[i].ff,sllx[i+1]);
     slly[i]=max(ll[i].ss,slly[i+1]);
     surx[i]=min(ur[i].ff,surx[i+1]);
     sury[i]=min(ur[i].ss,sury[i+1]);
   }
   int x1,y1,x2,y2;
   for(int i=1;i<=n;i++){
     x1=max(pllx[i-1],sllx[i+1]);
     y1=max(plly[i-1],slly[i+1]);
     x2=min(purx[i-1],surx[i+1]);
     y2=min(pury[i-1],sury[i+1]);

     if(x1<=x2 and y1<=y2){
      cout<<x1<<" "<<y1<<endl;
      return 0;
     }
   }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N=132679;
#define ff first
#define ss second

pair<int,pair<int,pair<int,int>>>p[N];

int main() {
    int n;
    cin>>n;

    for(int i=1; i<=n; i++) {
        int x1,x2,y1,y2;
        cin>>x1>>y1>>x2>>y2;
        p[i]= {x1,{y1,{x2,y2}}};
    }
    sort(p+1,p+n+1);

    int x11=p[1].ff,x22=p[1].ss.ss.ff,y11=p[1].ss.ff,y22=p[1].ss.ss.ss;

    int c=0;
    bool f=true;

    for(int i=2; i<=n; i++) {
        if((x11>p[i].ff and x11>p[i].ss.ss.ff) or (p[i].ff>x11 and p[i].ff>x22)) {
            c++;
            continue;
        } else if((y11>p[i].ss.ff and y11>p[i].ss.ss.ss) or (p[i].ss.ff>y11 and p[i].ss.ff>y22)) {
            c++;
            continue;
        }
        if(c>1){
            f=false;
            break;
        }
        x11=max(x11,p[i].ff);
        x22=min(x22,p[i].ss.ss.ff);

        y11=max(y11,p[i].ss.ff);
        y22=min(y22,p[i].ss.ss.ss);

    }
    int cnt=0;

    if(!f) {

        x11=p[1].ff,x22=p[1].ss.ss.ff,y11=p[1].ss.ff,y22=p[1].ss.ss.ss;

        f=true;
        for(int i=3; i<=n; i++) {
          if((x11>p[i].ff and x11>p[i].ss.ss.ff) or (p[i].ff>x11 and p[i].ff>x22)) {
            c++;
            continue;
        } else if((y11>p[i].ss.ff and y11>p[i].ss.ss.ss) or (p[i].ss.ff>y11 and p[i].ss.ff>y22)) {
            c++;
            continue;
        }
        if(c>1){
            f=false;
            break;
        }
        x11=max(x11,p[i].ff);
        x22=min(x22,p[i].ss.ss.ff);

        y11=max(y11,p[i].ss.ff);
        y22=min(y22,p[i].ss.ss.ss);
        }
    }
    cout<<x11<<" "<<y11<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N=132679;
pair<int,int>p1[N],p2[N];

int main() {
    int n;
    cin>>n;

    for(int i=1; i<=n; i++) {
        int x1,x2,y1,y2;
        cin>>x1>>y1>>x2>>y2;
        p1[i]= {x1,y1};
        p2[i]= {x2,y2};
    }
    sort(p1+1,p1+n+1);
    sort(p2+1,p2+n+1);

    int x11=p1[1].first,x22=p2[1].first,y11=p1[1].second,y22=p2[1].second;

    int c=0;
    bool f=true;

    for(int i=2; i<=n; i++) {
        if((x11>p1[i].first and x11>p2[i].first) or (p1[i].first>x11 and p1[i].first>x22)) {
            c++;
            continue;
        } else if((y11>p1[i].second and y11>p2[i].second) or (p1[i].second>y11 and p1[i].second>y22)) {
            c++;
            continue;
        }
        if(c>1){
            f=false;
            break;
        }
        x11=max(x11,p1[i].first);
        x22=min(x22,p2[i].first);

        y11=max(y11,p1[i].second);
        y22=min(y22,p2[i].second);

    }
    int cnt=0;

    if(!f) {
        x11=p1[2].first,x22=p2[2].first,y11=p1[2].second,y22=p2[2].second;

        f=true;
        for(int i=3; i<=n; i++) {
            if((x11>p1[i].first and x11>p2[i].first) or (p1[i].first>x11 and p1[i].first>x22)) {
                c++;
                continue;
            } else if((y11>p1[i].second and y11>p2[i].second) or (p1[i].second>y11 and p1[i].second>y22)) {
                c++;
                continue;
            }

            x11=max(x11,p1[i].first);
            x22=min(x22,p2[i].first);

            y11=max(y11,p1[i].second);
            y22=min(y22,p2[i].second);
        }
    }
    cout<<x11<<" "<<y11<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N=132679;
#define ff first
#define ss second

pair<int,pair<int,pair<int,int>>>p[N];

int main() {
    int n;
    cin>>n;

    for(int i=1; i<=n; i++) {
        int x1,x2,y1,y2;
        cin>>x1>>y1>>x2>>y2;
        p[i]= {x1,{y1,{x2,y2}}};
    }
    sort(p+1,p+n+1);

    int x11=p[1].ff,x22=p[1].ss.ss.ff,y11=p[1].ss.ff,y22=p[1].ss.ss.ss;

    int c=0;
    bool f=true;

    for(int i=2; i<=n; i++) {
        if((x11>p[i].ff and x11>p[i].ss.ss.ff) or (p[i].ff>x11 and p[i].ff>x22)) {
            c++;
            continue;
        } else if((y11>p[i].ss.ff and y11>p[i].ss.ss.ss) or (p[i].ss.ff>y11 and p[i].ss.ff>y22)) {
            c++;
            continue;
        }
        if(c>1){
            f=false;
            break;
        }
        x11=max(x11,p[i].ff);
        x22=min(x22,p[i].ss.ss.ff);

        y11=max(y11,p[i].ss.ff);
        y22=min(y22,p[i].ss.ss.ss);

    }
    int cnt=0;

    if(!f) {

        x11=p[2].ff,x22=p[2].ss.ss.ff,y11=p[2].ss.ff,y22=p[2].ss.ss.ss;

        f=true;
        for(int i=3; i<=n; i++) {
          if((x11>p[i].ff and x11>p[i].ss.ss.ff) or (p[i].ff>x11 and p[i].ff>x22)) {
            c++;
            continue;
        } else if((y11>p[i].ss.ff and y11>p[i].ss.ss.ss) or (p[i].ss.ff>y11 and p[i].ss.ff>y22)) {
            c++;
            continue;
        }
        if(c>1){
            f=false;
            break;
        }
        x11=max(x11,p[i].ff);
        x22=min(x22,p[i].ss.ss.ff);

        y11=max(y11,p[i].ss.ff);
        y22=min(y22,p[i].ss.ss.ss);
        }
    }
    cout<<x11<<" "<<y11<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int N=132679;
#define ff first
#define ss second

pair<int,pair<int,pair<int,int>>>p[N];

int main() {
    int n;
    cin>>n;

    for(int i=1; i<=n; i++) {
        int x1,x2,y1,y2;
        cin>>x1>>y1>>x2>>y2;
        p[i]= {x1,{y1,{x2,y2}}};
    }
    sort(p+1,p+n+1);

    int x11=p[1].ff,x22=p[1].ss.ss.ff,y11=p[1].ss.ff,y22=p[1].ss.ss.ss;

    int c=0;
    bool f=true;

    for(int i=2; i<=n; i++) {
        if((x11>p[i].ff and x11>p[i].ss.ss.ff) or (p[i].ff>x11 and p[i].ff>x22)) {
            c++;
            continue;
        } else if((y11>p[i].ss.ff and y11>p[i].ss.ss.ss) or (p[i].ss.ff>y11 and p[i].ss.ff>y22)) {
            c++;
            continue;
        }
        if(c>1){
            f=false;
            break;
        }
        x11=max(x11,p[i].ff);
        x22=min(x22,p[i].ss.ss.ff);

        y11=max(y11,p[i].ss.ff);
        y22=min(y22,p[i].ss.ss.ss);

    }
    int cnt=0;

    if(!f) {

        x11=p[2].ff,x22=p[2].ss.ss.ff,y11=p[2].ss.ff,y22=p[2].ss.ss.ss;

        f=true;
        for(int i=3; i<=n; i++) {
          if((x11>p[i].ff and x11>p[i].ss.ss.ff) or (p[i].ff>x11 and p[i].ff>x22)) {
            c++;
            continue;
        } else if((y11>p[i].ss.ff and y11>p[i].ss.ss.ss) or (p[i].ss.ff>y11 and p[i].ss.ff>y22)) {
            c++;
            continue;
        }
        if(c>1){
            f=false;
            break;
        }
        x11=max(x11,p[i].ff);
        x22=min(x22,p[i].ss.ss.ff);

        y11=max(y11,p[i].ss.ff);
        y22=min(y22,p[i].ss.ss.ss);
        }
    }
    cout<<x22<<" "<<y22<<endl;
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=1;
    int temp;
    if(ck(tp1, tp2)) {
        temp=tp1.cnt;
        tp1=tp;
        tp1.cnt=temp+1;
    }
    for(int i=3;i<=n;i++) {
        if(ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        if(ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }

    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x2, tp1.y2);
    else if(tp2.cnt>=n-1) printf("%d %d\n", tp2.x2, tp2.y2);
    else {
        printf("%d %d\n", tp1.cnt, tp2.cnt);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=1;
    int temp;
    for(int i=3;i<=n;i++) {
        if(ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        else if(ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }
    if(ck(tp1, st[2])) {
        temp=tp1.cnt;
        tp1=tp;
        tp1.cnt=temp+tp2.cnt;
    }
    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x1, tp1.y1);
    else if(tp2.cnt>=n-1) printf("%d %d\n", tp2.x1, tp2.y1);
    else {
        printf("+++%d %d\n", tp1.cnt, tp2.cnt);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=1;
    int temp;
    if(ck(tp1, tp2)) {
        temp=tp1.cnt;
        tp1=tp;
        tp1.cnt=temp+1;
    }
    for(int i=3;i<=n;i++) {
        if(ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        if(ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }
    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x2, tp1.y2);
    else printf("%d %d\n", tp2.x2, tp2.y2);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=0;
    int temp;
    if(ck(tp1, tp2)) {
        temp=tp1.cnt;
        tp1=tp;
        tp1.cnt=temp+1;
    }
    if(ck(tp1, tp2)) {
        temp=tp2.cnt;
        tp2=tp;
        tp2.cnt=temp+1;
    }
    for(int i=3;i<=n;i++) {
        if(ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        if(ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }

    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x2, tp1.y2);
    else if(tp2.cnt>=n-1) printf("%d %d\n", tp2.x2, tp2.y2);
    else {
        printf("%d %d\n", tp1.cnt, tp2.cnt);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=1;
    int temp;
    if(ck(tp1, tp2)) {
        temp=tp1.cnt;
        tp1=tp;
        tp1.cnt=temp+1;
    }
    for(int i=3;i<=n;i++) {
        if(ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        if(ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }
    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x1, tp1.y1);
    else printf("%d %d\n", tp2.x1, tp2.y1);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
    bool operator < (const node &p ) const {
        if(x2-x1!=p.x2-p.x1) return x2-x1<p.x2-p.x1;
        return y2-y1<p.y2-p.y1;
    }
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    sort(st+1, st+1+n);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=1;
    for(int i=3;i<=n;i++) {
        int temp;
        if(ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        if(ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }
    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x1, tp1.y1);
    else printf("%d %d\n", tp2.x1, tp2.y1);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=1;
    int temp;
    for(int i=n;i>0;i--) {
        if(i!=1&&ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        if(i!=2&&ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }

    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x1, tp1.y1);
    else if(tp2.cnt>=n-1) printf("%d %d\n", tp2.x1, tp2.y1);
    else {
        printf("%d %d\n", tp1.cnt, tp2.cnt);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>

using namespace  std;
#define met(a, b) memset(a, b, sizeof(a))
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int maxn = 2e5 + 10;
const ll inf = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int mod = 1e9+7;
inline ll mul(ll x, ll y, ll mod) {ll res = (x * y - (ll)(ld)(x / mod * y + 1e-8) * mod); return res < 0 ? res + mod : res;}
ll qPow(ll base, ll n) {ll res = 1; while(n) {if(n & 1) res = (res * base); base = (base * base); n >>= 1;} return res;}

struct node {
    int x1, y1, x2, y2;
    int cnt;
}st[maxn], tp;

bool ck(node a, node b) {
    tp.x1=max(a.x1, b.x1);
    tp.x2=min(a.x2, b.x2);
    tp.y1=max(a.y1, b.y1);
    tp.y2=min(a.y2, b.y2);
    return tp.x1<=tp.x2&&tp.y1<=tp.y2;
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d%d%d%d", &st[i].x1, &st[i].y1, &st[i].x2, &st[i].y2);
    node tp1=st[1], tp2=st[2];
    tp1.cnt=tp2.cnt=1;
    int temp;
    if(ck(tp1, tp2)) {
        temp=tp1.cnt;
        tp1=tp;
        tp1.cnt=temp+1;
    }
    for(int i=3;i<=n;i++) {
        if(ck(tp1, st[i])) {
            temp=tp1.cnt;
            tp1=tp;
            tp1.cnt=temp+1;
        }
        if(ck(tp2, st[i])) {
            temp=tp2.cnt;
            tp2=tp;
            tp2.cnt=temp+1;
        }
    }
    if(tp1.cnt>=n-1) printf("%d %d\n", tp1.x2, tp1.y2);
    else if(tp2.cnt>=n-1) printf("%d %d\n", tp2.x2, tp2.y2);
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
//#define DEBUG
#define mod 1000000007

int arr[3][3];

int main(){
    ios::sync_with_stdio(false);
    #ifdef DEBUG
    freopen("input.txt", "r", stdin);
    #endif // DEBUG

    string s;
    cin>>s;
    bool found=false;
    string out;
    for(int i=0;i<s.size();i++){
        if(s[i] == '0' && found)
            out.push_back(s[i]);
        else if(s[i]=='1')
            out.push_back(s[i]);
        if(s[i]=='0' && !found)
            found = true;
    }
    cout<<out;

    return 0;
}


/*
Ctrl-F "!GLOB" to see functions and other definitions, specific to task
Ctrl-F "!MAIN" to see code in the main function
*/

#ifndef MY
#define NDEBUG // only use assert locally
#endif

#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <cassert>
#include <cstring>
#include <sstream>
//#include <unordered_map>
//#include <unordered_set>

using namespace std;

const double PI = 3.14159265358979323846;
const double SQRT2 = 1.41421356237;
const double EPS = 1e-9;

const float SQRT2F = (float)SQRT2;

#define input_file(s) freopen(s, "r", stdin)
#define output_file(s) freopen(s, "w", stdout)

#define TASK_FILE_NAME ""
//#define USE_TXT_EXT_FILES // input.txt, output.txt
#define USE_STD_STREAMS // stdin, stdout - codeforces

#if defined(MY) && !defined(USE_STD_STREAMS)
#define USE_STD_STREAMS
#endif

typedef signed short int int16;
typedef unsigned short int uint16;
typedef unsigned int uint;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef pair<int, int> ipair;

template<class T>
T sqr(const T &x) { return x * x; }

template<class T>
T min(const T &a, const T &b, const T &c) { return min(min(a, b), c); }

template<class T>
T max(const T &a, const T &b, const T &c) { return max(max(a, b), c); }

inline void yesno(bool y) { cout << (y? "YES\n" : "NO\n"); }
inline void yesno2(bool y) { cout << (y? "Yes\n" : "No\n"); }
inline void yesno3(bool y) { cout << (y? "yes\n" : "no\n"); }

inline void yesstop(bool y) { if (y) { yesno(1); exit(0); } }
inline void yesstop2(bool y) { if (y) { yesno2(1); exit(0); } }
inline void yesstop3(bool y) { if (y) { yesno3(1); exit(0); } }

// !GLOB

int main() {
    #ifndef USE_STD_STREAMS
    #ifdef USE_TXT_EXT_FILES
    input_file("input.txt");
    output_file("output.txt");
    #else
    input_file(TASK_FILE_NAME".in")
    output_file(TASK_FILE_NAME".out");
    #endif
    #endif

    // !MAIN

    char a[100500];

    cin >> a;

    bool x = 0;
    for (int i = 0; a[i]; ++i) {
        if (a[i] == '0') {
            if (x) {
                cout << a[i];
            }
            x = 1;
            continue;
        }
        if (a[i + 1] || x) cout << a[i];
    }
    cout << endl;

    return 0;
}


/*
Ctrl-F "!GLOB" to see functions and other definitions, specific to task
Ctrl-F "!MAIN" to see code in the main function
*/

#ifndef MY
#define NDEBUG // only use assert locally
#endif

#include <iostream>
#include <cstdio>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <cassert>
#include <cstring>
#include <sstream>
//#include <unordered_map>
//#include <unordered_set>

using namespace std;

const double PI = 3.14159265358979323846;
const double SQRT2 = 1.41421356237;
const double EPS = 1e-9;

const float SQRT2F = (float)SQRT2;

#define input_file(s) freopen(s, "r", stdin)
#define output_file(s) freopen(s, "w", stdout)

#define TASK_FILE_NAME ""
//#define USE_TXT_EXT_FILES // input.txt, output.txt
#define USE_STD_STREAMS // stdin, stdout - codeforces

#if defined(MY) && !defined(USE_STD_STREAMS)
#define USE_STD_STREAMS
#endif

typedef signed short int int16;
typedef unsigned short int uint16;
typedef unsigned int uint;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef pair<int, int> ipair;

template<class T>
T sqr(const T &x) { return x * x; }

template<class T>
T min(const T &a, const T &b, const T &c) { return min(min(a, b), c); }

template<class T>
T max(const T &a, const T &b, const T &c) { return max(max(a, b), c); }

inline void yesno(bool y) { cout << (y? "YES\n" : "NO\n"); }
inline void yesno2(bool y) { cout << (y? "Yes\n" : "No\n"); }
inline void yesno3(bool y) { cout << (y? "yes\n" : "no\n"); }

inline void yesstop(bool y) { if (y) { yesno(1); exit(0); } }
inline void yesstop2(bool y) { if (y) { yesno2(1); exit(0); } }
inline void yesstop3(bool y) { if (y) { yesno3(1); exit(0); } }

// !GLOB

int main() {
    #ifndef USE_STD_STREAMS
    #ifdef USE_TXT_EXT_FILES
    input_file("input.txt");
    output_file("output.txt");
    #else
    input_file(TASK_FILE_NAME".in")
    output_file(TASK_FILE_NAME".out");
    #endif
    #endif

    // !MAIN

    char a[100500];

    cin >> a;

    bool x = 0;
    for (int i = 0; a[i]; ++i) {
        if (a[i] == '0') {
            if (x) {
                cout << a[i];
            }
            x = 1;
            continue;
        }
        cout << a[i];
    }
    cout << endl;

    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <fstream>
#include <sstream>
#include <map>
#include <list>
#include <cmath>
#include <bitset>
#include <stack>
#include <stdio.h>
#include <cstring>
#include <ctime>
#include <ctype.h>
#include <utility>
#include <stdlib.h>
#include <stdio.h>
#include <cstdio>
using namespace std;

#define ll long long
#define INF 100000000

int main()
{
    string s;
    cin >> s;

    bool good = false;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '0')
        {
            s.erase(i, 1);
            good = true;
            break;
        }
    }

    if (!good)
        s.erase(0, 1);

    cout << s << endl;
}


//by maximumSHOT

#define _USE_MATH_DEFINES

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <time.h>
#include <clocale>
#include <fstream>
//#include <conio.h>

using namespace std;

#define forx(i,n) for(int i(0);i < n;i++)
#define vec vector

typedef long L;
typedef long long LL;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<double> vdouble;
typedef vector<vector<double>> vvdouble;
typedef vec<bool> vbool;
typedef vec<vec<bool>> vvbool;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<double,int> pdi;
typedef pair<int,double> pid;
typedef unsigned long long ull;
typedef unsigned int ui;
const int inf = 1000 * 1000 * 1000;
const LL inf64 = LL(inf) * inf;

void show(LL a){cout << a--;}

bool solve()
{
    ios_base::sync_with_stdio(0);
    bool flag = true;
    string a;

    cin >> a;
    int g;
    if(count(a.begin(),a.end(),'0') == 0)
    {
        cout << a.substr(0,a.size()-1);
    }else
    {
        for(int i(0);i < a.length();i++)
        {
            if(a[i] != '0')
                cout << a[i];
            else
            {
                g = i;
                break;
            }
        }
        for(int i = g+1;i < a.length();i++)
            cout << a[i];
    }

    //_getch();
    return true;
}

int main(int argc,char **argv)
{
    //while(solve());
    solve();

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#define pb push_back
#define ll long long
#define mp make_pair
#define ff first
#define sc second
#define pii pair<int,int>
#define pis pair<int, string>
#define psi pair<string, int>
using namespace std;
int main () {
	string s;
	cin >> s;
	int n = s.size(), k = 0, z = 0;
	for(int i = 0; i<n; i++){
		if(s[i] == '0' && !z) {
			k = i;
			z = 1;
		}
	}
	for(int i = 0; i<n; i++)
		if(k!=i) cout << s[i];

    return 0;
}


#include <iostream>
#include <algorithm>

int main() {
	std::cin.sync_with_stdio(false);
	std::cout.sync_with_stdio(false);

	std::string n;
	std::cin >> n;

	std::string::iterator k = std::find(n.begin(), n.end(), '0');
	if (k == n.end()) {
		k--;
	}
	n.erase(k);

	std::cout << n << "\n";

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
//#pragma comment(linker, "/STACK:100000000")
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <stdio.h>
#include <vector>
#include <map>
#include <deque>

#define ll long long
#define ld long double
#define f(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define fn(i, b) for(int i=0; i<(int) (b); i++)
#define fz(i, a, b) for (int i=(int)(a); i>=(int)(b); --i)
#define mp make_pair
#define pii pair<int, int>
#define pb push_back
#define bg begin()
#define ed end()
#define pi 3.141592653589793238462643383279
#define sqr(A) A*A*1.0
ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return (((a*b) / gcd(a, b))); }

int phi(int n){
	int result = n;
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) n /= i;
			result -= result / i;
		}
	}
	if (n > 1) result -= result / n;
	return result;
}

int catalan(unsigned int n){
	int c[100];
	c[0] = c[1] = 1;
	f(i, 2, n) {
		f(k, 0, i)
			c[i] += c[k] * c[i - 1 - k];
	}
	return c[n];
}

#define MAX 100010
#define INF 1000000
#define eps 0.0001
#define ls (v << 1)
#define rs ((v << 1)+1)
using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

	//while (1)
	{
		string s;
	cin >> s;
	int N = s.length();
	int j = N - 1;
	while (j > 0 && s[j] != '1') j--;
	while (j > 0 && s[j] == '1') j--;
	while (j > 0 && s[j] == '0') j--;
	j++;
	for (int i = 0; i < N; i++) {
		if (i == j) continue;
		putchar(s[i]);
	}
	puts("");
}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
//#pragma comment(linker, "/STACK:100000000")
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <stdio.h>
#include <vector>
#include <map>
#include <deque>

#define ll long long
#define ld long double
#define f(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define fn(i, b) for(int i=0; i<(int) (b); i++)
#define fz(i, a, b) for (int i=(int)(a); i>=(int)(b); --i)
#define mp make_pair
#define pii pair<int, int>
#define pb push_back
#define bg begin()
#define ed end()
#define pi 3.141592653589793238462643383279
#define sqr(A) A*A*1.0
ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return (((a*b) / gcd(a, b))); }

int phi(int n){
	int result = n;
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) n /= i;
			result -= result / i;
		}
	}
	if (n > 1) result -= result / n;
	return result;
}

int catalan(unsigned int n){
	int c[100];
	c[0] = c[1] = 1;
	f(i, 2, n) {
		f(k, 0, i)
			c[i] += c[k] * c[i - 1 - k];
	}
	return c[n];
}

#define MAX 100010
#define INF 1000000
#define eps 0.0001
#define ls (v << 1)
#define rs ((v << 1)+1)
using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

	//while (1)
	{
		string s;
	cin >> s;
	int N = s.length();
	int j = N - 1;
	while (j > 0 && s[j] != '1') j--;
	while (j > 0 && s[j] == '1') j--;
	for (int i = 0; i < N; i++) {
		if (i == j) continue;
		putchar(s[i]);
	}
	puts("");
}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
//#pragma comment(linker, "/STACK:100000000")
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <stdio.h>
#include <vector>
#include <map>
#include <deque>

#define ll long long
#define ld long double
#define f(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define fn(i, b) for(int i=0; i<(int) (b); i++)
#define fz(i, a, b) for (int i=(int)(a); i>=(int)(b); --i)
#define mp make_pair
#define pii pair<int, int>
#define pb push_back
#define bg begin()
#define ed end()
#define pi 3.141592653589793238462643383279
#define sqr(A) A*A*1.0
ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return (((a*b) / gcd(a, b))); }

int phi(int n){
	int result = n;
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) n /= i;
			result -= result / i;
		}
	}
	if (n > 1) result -= result / n;
	return result;
}

int catalan(unsigned int n){
	int c[100];
	c[0] = c[1] = 1;
	f(i, 2, n) {
		f(k, 0, i)
			c[i] += c[k] * c[i - 1 - k];
	}
	return c[n];
}

#define MAX 100010
#define INF 1000000
#define eps 0.0001
#define ls (v << 1)
#define rs ((v << 1)+1)
using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

	//while (1)
	{
		string s;
	cin >> s;
	int N = s.length();
	int j = N - 1;
	while (j > 0 && s[j] != '1') j--;
	while (j > 0 && s[j] == '1') j--;
	while (j > 0 && s[j] == '0') j--;

	for (int i = 0; i < N; i++) {
		if (i == j) continue;
		putchar(s[i]);
	}
	puts("");
}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
//#pragma comment(linker, "/STACK:100000000")
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <stdio.h>
#include <vector>
#include <map>
#include <deque>

#define ll long long
#define ld long double
#define f(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define fn(i, b) for(int i=0; i<(int) (b); i++)
#define fz(i, a, b) for (int i=(int)(a); i>=(int)(b); --i)
#define mp make_pair
#define pii pair<int, int>
#define pb push_back
#define bg begin()
#define ed end()
#define pi 3.141592653589793238462643383279
#define sqr(A) A*A*1.0
ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return (((a*b) / gcd(a, b))); }

int phi(int n){
	int result = n;
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			while (n % i == 0) n /= i;
			result -= result / i;
		}
	}
	if (n > 1) result -= result / n;
	return result;
}

int catalan(unsigned int n){
	int c[100];
	c[0] = c[1] = 1;
	f(i, 2, n) {
		f(k, 0, i)
			c[i] += c[k] * c[i - 1 - k];
	}
	return c[n];
}

#define MAX 100010
#define INF 1000000
#define eps 0.0001
#define ls (v << 1)
#define rs ((v << 1)+1)
using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

	//while (1)
	{
		string s;
	cin >> s;
	int N = s.length();
	int j = 0;
	while (j < N && s[j] == '1') j++;
	if (j == N) j--;
	for (int i = 0; i < N; i++) {
		if (i == j) continue;
		putchar(s[i]);
	}
	puts("");
}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
void count(){
    #ifndef ONLINE_JUDGE
        freopen ("input.txt", "r", stdin);
    #endif
}
int main(){
    //count();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
void count(){
    #ifndef ONLINE_JUDGE
        freopen ("input.txt", "r", stdin);
    #endif
}
int main(){
    //count();
    string s;
    cin >> s;
    int l = s . length();
    bool flag = false;
    l --;
    for(int i=0; i<l; ++i){
        if(s[i] == '0' && !flag){
            flag = true;
        }
        else cout << s[i];
    }
    if(flag) cout << s[l];
    return 0;
}


/*
 *  C.cxx
 *
 * 	Author : Pallab
 * 	Created on: 9:51:16 PM - 2012:12:22
 * 	"I have not failed, I have just found 10000 ways that won't work."
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <numeric>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )
#define line puts("")

inline void wait ( double seconds ) {
    double endtime = clock() + ( seconds * CLOCKS_PER_SEC );
    while ( clock() < endtime ) {
        ;
    }
}
template<class T>
    inline T fastIn() {
    register char c=0;
    register T a=0;
    bool neg=false;
    while ( c<33 ) c=getchar();
    while ( c>33 ) {
        if ( c=='-' ) {
            neg=true;
        } else {
            a= ( a*10 ) + ( c-'0' );
        }
        c=getchar();
    }
    return neg?-a:a;
}
string ss;
int l;
inline void read() {
    cin>>ss;
    l=LN ( ss );
}
inline void proc() {
    int indx=-1;
    for ( int i=0, _i=l; i < _i; ++i ) {
        if ( ss[i]=='0' ) {
            indx=i;
            break;
        }
    }
    if ( indx==-1 ) {
        for ( int i=0, _i=l-1; i < _i; ++i ) {
            putchar ( ss[i] );
        }
        line;
    } else {
        for ( int i=0, _i=l; i < _i; ++i ) {
            if ( i==indx ) continue;
            putchar ( ss[i] );
        }
        line;
    }
}
int main() {
    int kase = 1;
#if defined( xerxes_pc )
    freopen ( "in1", "r", stdin );
    kase = 2;
#endif
    for ( int i=1; i<=kase; ++i ) {
        read();
        proc();
    }
    return 0;
}

// kate: indent-mode cstyle; indent-width 4; replace-tabs on;


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <string>
#include <map>
#include <stack>
#define sqr(a) a*a;
using namespace std;
const int INF = 2000000000;
int main()
{
    char l;
    string s = "";
    while (cin >> l )
    {
        s += l;
    }

    int t=0;
    for(int i = 1; i < s.length(); i++)
    {
        if(s[i] > s[t])
            break;
        if(s[i]<s[t])
        {
            t=i;
        }
    }
    s.erase(t,1);

    cout<<s<<endl;
    return 0;
}


//152875TP
//solution by IHKIM
//WRONG ANSWER
#include<iostream>
#include<cmath>
#include<fstream>
#include<cstdio>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<math.h>
#include<time.h>
#include<queue>
#include<stack>
#include<deque>

//TEMPLATE STARTS HERE
using namespace std;

//constants
const int MAXN=(int)(1e5+1e1);
const double PI=acos(-1.0);

//defines
#define ll long long
#define F first
#define S second
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define mp make_pair
#define pb push_back
#define eof (-1)
#define forr(xx,yy,zz) for(int zz=xx;zz<=yy;zz++)
#define forl(xx,yy,zz) for(int zz=xx;zz>=yy;zz--)
#define sqr(x) ((x)*(x))
#define sz(x) (int)x.size()
#define len(s) (int)(s.length())
#define all(a) a.begin(),a.end()
string s,t;
ll q;
int main()
{
	ios::sync_with_stdio(false);
	cin>>s;
	q=-11;
	forr(0,len(s)-1,i)
	{
		if(s[i]=='0')
		{
			q=i;
			break;
		}
	}
	if(q!=-11)
	{
		s.erase(q,1);
	}
	else
	{
		s.erase(1,1);
	}
	cout<<s;
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <string>
#include <map>
#include <sstream>

using namespace std;

main() {
    string s;
    cin >> s;

    string::size_type loc = s.find("0", 0 );
    if(loc != string::npos ) {
        cout << s.substr(0, loc) << s.substr(loc + 1);
    } else {
        cout << s.substr(1);
    }
}


#include <iostream>
#include <cstring>

using namespace std;

string a;

int main()
{
    cin >> a;

    int pos = 0;

    for ( int i = 0; i < a.size(); ++i )
    {
        if ( a[i] != '0' )
        {
            pos = i;
            break;
        }
        else
        {
            a[i] = '*';
        }
    }

    int valid = 0;

    for ( int i = pos; i < a.size(); ++i )
    {
        if ( a[i] == '0' )
        {
            a[i] = '*';
            valid = 1;
            break;
        }
    }

    if ( !valid )
            a[ a.size() - 1 ] = '*';

    for ( int i = 0; i < a.size(); ++i )
            if ( a[i] != '*' )
                    cout << a[i];

    return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#define pb push_back
#define mp make_pair
#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;

int main(){
    string s;
    string ret="";
    cin>>s;
    if (s=="0") {
        cout<<0<<endl;
    }
    bool flag = false;
    for (int i=0;i<s.length();i++) {
        if (s[i]=='0') {
            s[i]='9';
            flag=true;
            break;
        }
    }
    if (flag) {
        for (int i=0;i<s.length();i++) {
            if (s[i]!='9') {
                cout<<s[i];
            }
        }
    } else {
        for (int i=0;i<s.length()-1;i++) {
            cout<<s[i];
        }
    }
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>

#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)(1e5) + 5;
const ld eps = 1e-18;
const int INF = (int)(2e9) + 7;

using namespace std;

int a[3][3];

int main()
{
    string s;
    cin >> s;
    if (s.find("0") == string::npos)
        cout << s.substr(1, s.size() - 1) << endl;
    else
        cout << s.substr(0, s.find("0")) + s.substr(s.find("0") + 1, s.size() - s.find("0") - 1) << endl;
    return 0;
}


#include <cstdio>
#include <iostream>

#include <vector>
#include <list>
#include <string>

#include <algorithm>
#include <functional>
#include <cmath>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;

bool compare_less(const string &s, size_t a, size_t b)
{
    size_t i = 0, j = 0;

    if(i == a) ++i;
    if(j == b) ++j;
    while(i < s.size() && j < s.size()) {
        if(s[i] < s[j])
            return true;
        else if(s[i] > s[j])
            return false;

        ++i;
        ++j;
        if(i == a) ++i;
        if(j == b) ++j;
    }

    return false;
}

void print_value(const string &s, size_t a)
{
    for(size_t i = 0; i < s.size(); ++i)
        if(i != a)
            cout << s[i];
    cout << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    size_t i = 0;
    while(i < s.size() && s[i] != '0') {
        cout << s[i];
        ++i;
    }
    ++i;
    while(i < s.size()) {
        cout << s[i];
        ++i;
    }
    cout << endl;

    // size_t ans = 0;
    // for(size_t i = 0; i < s.size(); ++i)
    //     if(compare_less(s, ans, i))
    //         ans = i;

    // print_value(s, ans);

    return 0;
}


#include <cstdio>
#include <iostream>

#include <vector>
#include <list>
#include <string>

#include <algorithm>
#include <functional>
#include <cmath>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;

bool compare_less(const string &s, size_t a, size_t b)
{
    size_t i = 0, j = 0;

    if(i == a) ++i;
    if(j == b) ++j;
    while(i < s.size() && j < s.size()) {
        if(s[i] < s[j])
            return true;
        else if(s[i] > s[j])
            return false;

        ++i;
        ++j;
        if(i == a) ++i;
        if(j == b) ++j;
    }

    return false;
}

void print_value(const string &s, size_t a)
{
    for(size_t i = 0; i < s.size(); ++i)
        if(i != a)
            cout << s[i];
    cout << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;

    size_t i = 0;
    while(i < s.size() - 1 && s[i] != '0') {
        cout << s[i];
        ++i;
    }
    ++i;
    while(i < s.size()) {
        cout << s[i];
        ++i;
    }
    cout << endl;

    // size_t ans = 0;
    // for(size_t i = 0; i < s.size(); ++i)
    //     if(compare_less(s, ans, i))
    //         ans = i;

    // print_value(s, ans);

    return 0;
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<string>
#include<algorithm>
#include<list>
#include<map>
#include<vector>
#include<queue>
#include<cmath>
#include<stack>
#include<deque>
using namespace std;
typedef long long ll;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int INF = 0x7f7f7f7f;
const int maxn = 111111;
char s[maxn];
int pos,len;
void go()
{
	int i;
	for(i=0;i<len;i++)
	{
		if(s[i]=='0')
		{
			pos=i;
			return;
		}
	}
	pos=len-1;
}
int main() {
	scanf("%s",s);
	len=strlen(s);
	go();
	for(int i=0;i<len;i++)
	{
		if(i==pos) continue;
		putchar(s[i]);
	}
	puts("");
	return 0;
}


#include<set>
#include<cmath>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<numeric>
#include<vector>
#include<ctime>
#include<queue>
#include<list>
#include<map>
#define pi acos(-1)
#define INF 0x7fffffff
#define clr(x)  memset(x,0,sizeof(x));
#define clrto(x,siz,y)  for(int xx=0;xx<=siz;xx++)  x[xx]=y;
#define clrset(x,siz)  for(int xx=0;xx<=siz;xx++)  x[xx]=xx;
#define clrvec(x,siz) for(int xx=0;x<=siz;xx++)  x[xx].clear();
#define fop   freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define myprogram By_135678942570
#define clrcpy(x,siz,y)  for(int xx=0;xx<siz;xx++)  x[xx]=y[xx];
using namespace std;
int main()
{
      char s[100011]={0};
      scanf("%s",s);
      int len=strlen(s);
      int flag=0;
      for(int i=0;i<len;i++)
      {
         if(s[i]=='0')
         {
            s[i]='2';
            flag=1;
            break;
         }
      }
      if(!flag)
         s[0]='2';
      for(int i=0;i<len;i++)
         if(s[i]!='2')
            printf("%c",s[i]);
      puts("");
      return 0;
}


#include <iostream>
#include <string>
using namespace std;

int main(void)
{
	string str;
	cin >> str;
	string::size_type loc = str.find('0');
	if (loc != string::npos)
		str.erase(loc, 1);
	else
		str.pop_back();
	cout << str;
	return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  int i = 0;
  unsigned long long size = s.size();
  while(i < size && s[i] != '0') i++;
  if(i == size) i = 0; /* Doesn't matter which */
  s.erase(i,1);
  cout << s << endl;
}


#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  cin >> s;
  int i = 0;
  while(s[i] != '0') i++;
  s.erase(i,1);
  cout << s << endl;
}


#include <iostream>
using namespace std;

int main()
{
	string s;
	cin >> s;
	bool found_0=false;
	for(int i=0; i<s.length()-1; i++)
	{
		if(s[i]=='1') cout << s[i];
		else
		{
			if(found_0) cout << s[i];
			else found_0=true;
		}
	}
	if(found_0) cout << s[s.length()-1];
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<queue>
#include<set>

using namespace std;

#define MAX_LEN 100003

char num[MAX_LEN];

int main(){
	scanf("%s",num);
	int idx=0;
	int len=strlen(num);
	for(int i=0;i<len;++i){
		if(num[i]=='0'){
			idx=i;
			break;
		}
	}

	for(int i=0;i<len;++i){
		if(i!=idx)
			printf("%c",num[i]);
	}
	printf("\n");
	return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define SZ(a) (int)(a.size())
#define sorta(a) sort(a.begin(),a.end())
#define sortrev(a) sort(a.rbegin(),a.rend())
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define VI vector<int>
typedef long long LL;
using namespace std;
LL powmod(LL a, LL p, LL mod)
{
	LL ret = 1;while(p){if(p&1)ret = (ret*a)%mod;a=(a*a)%mod;p/=2;}return ret;
}
int pow(int a, int p)
{
	int ret = 1;while(p){if(p&1)ret = (ret*a);a=(a*a);p/=2;}return ret;
}
int main()
{
	cin.sync_with_stdio(0);
	cin.tie(0);
	char s[100002];
	cin>>s;
	int f=0;
	int in=-1;
	int n=strlen(s);
	for(int i=0;i<n;i++)
	{
		if(s[i]=='0')
		{
			f=1;
			in=i;
			break;
		}
	}
	if(f==1)
	{
		rep(i,0,n)
		{
			if(i!=in)
				cout<<s[i];
		}
		cout<<endl;
	}
	else
	{
		rep(i,0,n-1)
		{
			cout<<"1";
		}
		cout<<endl;
	}
	 return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define SZ(a) (int)(a.size())
#define sorta(a) sort(a.begin(),a.end())
#define sortrev(a) sort(a.rbegin(),a.rend())
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define VI vector<int>
typedef long long LL;
using namespace std;
LL powmod(LL a, LL p, LL mod)
{
	LL ret = 1;while(p){if(p&1)ret = (ret*a)%mod;a=(a*a)%mod;p/=2;}return ret;
}
int pow(int a, int p)
{
	int ret = 1;while(p){if(p&1)ret = (ret*a);a=(a*a);p/=2;}return ret;
}
int main()
{
	cin.sync_with_stdio(0);
	cin.tie(0);
	char s[100002];
	cin>>s;
	int f=0;
	int in=-1;
	for(int i=0;i<strlen(s);i++)
	{
		if(s[i]=='0')
		{
			f=1;
			in=i;
			break;
		}
	}
	if(f==1)
	{
		rep(i,0,strlen(s))
		{
			if(i!=in)
				cout<<s[i];
		}
		cout<<endl;
	}
	else
	{
		rep(i,0,strlen(s)-1)
		{
			cout<<"1";
		}
		cout<<endl;
	}
	 return 0;
}


#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cctype>
#include <cstdio>
#include <iomanip>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <complex>
#include <numeric>
#include <valarray>
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define inf 1061109567
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define mem(x,a) memset(x,a,sizeof(x))
#define rep(i,n) for(int i(0),_n(n);i<_n;++i)
#define repi(i,a,b) for(int i(a),_b(b);i<_b;++i)
#define repe(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define len(x) ((int)(x.size()))

string s1,s2;

int main(){
	ios_base::sync_with_stdio(0);

	cin>>s1;

	rep(i,len(s1)){
		if(s1[i]=='0'){
			cout<<s1.substr(0,i)+s1.substr(i+1)<<endl;
			return 0;
		}
	}
	cout<<s1.substr(1)<<endl;

}


#include<cstdio>
#include<cstring>
char vet[100100];
char resp[100100];
int aux;
int ultimo;
int srt;
int main(){
    scanf("%s",vet);
    srt=strlen(vet);
    for(int i=0;i<srt;i++){
        if(aux==0 && vet[i]=='0'){
            aux=1;
        }
        else{
            resp[ultimo++]=vet[i];
        }
    }
    resp[(srt-1)]='\0';
    printf("%s",resp);
    scanf("%.c");
    return 0;
}


#include<cstdio>
#include<cstring>
char vet[100100];
char resp[100100];
int aux;
int ultimo;
int main(){
    scanf("%s",vet);
    for(int i=0;i<strlen(vet);i++){
        if(aux==0 && vet[i]=='0'){
            aux=1;
        }
        else{
            resp[ultimo++]=vet[i];
        }
    }
    resp[strlen(vet)]='/0';
    printf("%s",resp);
    scanf("%.c");
    return 0;
}


#include<cstdio>
#include<cstring>
char vet[100100];
char resp[100100];
int aux;
int ultimo;
int main(){
    scanf("%s",vet);
    for(int i=0;i<strlen(vet);i++){
        if(aux==0 && vet[i]=='0'){
            aux=1;
        }
        else{
            resp[ultimo++]=vet[i];
        }
    }
    resp[(strlen(vet)-1)]='\0';
    printf("%s",resp);
    scanf("%.c");
    return 0;
}


#include <iostream>
#include <cstdio>

using namespace std;

int main() {
    //freopen("in.txt", "r", stdin);
    string s;

    cin >> s;
    if (s.find('0') == string::npos) {
        cout << s.substr(1);
    } else {
        int p = s.find('0');
        cout << s.substr(0, p) + s.substr(p + 1);
    }

    return 0;
}


//in the name of god
#include <iostream>
#include <string>
using namespace std;

int main(){
	long long x=0;
	string s;
	cin>>s;

	long long len = s.length();
	for (long long i=0;i<len;i++){
		if (s[i]=='0'){
			x=i;
			break;
		}
	}
	for (long long i=0;i<len;i++){
		if (i!=x)
			cout<<s[i];
	}

	return 0;
}


#include<stdio.h>

int main(){
	char num[100005];
	int fl=0;
	int fl1=0;
	scanf("%[^\n]%*c",num);
	int i;
	for(i=0;num[i+1]!='\0';i++){
		if(num[i]=='1')
			fl1=1;
		if( num[i]=='0' && !fl++)
			continue;
		if(fl1)
			printf("%c",num[i]);
	}
	if(fl)
		printf("%c",num[i]);
	printf("\n");
}


#include<stdio.h>

int main(){
	char num[100005];
	int fl=0;
	scanf("%[^\n]%*c",num);
	for(int i=0;num[i]!='\0';i++){
		if(num[i]=='0' && !fl++)
			continue;
		printf("%c",num[i]);
	}
	printf("\n");
}


#include<stdio.h>

int main(){
	char num[100005];
	int fl=0;
	int fl1=0;
	scanf("%[^\n]%*c",num);
	for(int i=0;num[i]!='\0';i++){
		if(num[i]=='1')
			fl1=1;
		if( num[i]=='0' && !fl++)
			continue;
		if(fl1)
			printf("%c",num[i]);
	}
	printf("\n");
}


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
      string s;
      cin>>s;
      bool nf=true;
      int n=s.length();
      for(int i=0;i<n;i++){
        if((s[i]!='0'&& i!=n-1)|| (i==n-1 && !nf)){
          cout<<s[i];
        }
        else
        if(s[i]=='0' && nf){
            nf=false;

        }
        else if (s[i]=='0' && !nf)
        {cout<<s[i];}

      }
      cout<<endl;

   return 0;
}


#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
      string s;
      cin>>s;
      bool nf=true;
      int n=s.length();
      for(int i=0;i<n;i++){
        if((s[i]!='0'&& i!=n-1)){
          cout<<s[i];
        }
        else
        if(s[i]=='0' && nf){
            nf=false;

        }
        else if (s[i]=='0' && !nf)
        {cout<<s[i];}

      }
      cout<<endl;

    return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main()
{
    char ch;
    int a[100000], n = 0;
    bool b = 0;
    while(cin >> ch)
        if(ch >= '0' && ch <= '9')
            a[n++] = ch - '0';
        else
            break;
    for(int i = 0; i < n - 1; i++)
        if(b || a[i])
            cout << a[i];
        else
        {
            b = 1;
            continue;
        }
    if(b)
        cout << a[n - 1];
    cout << endl;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define LL __int64
char s[100005];
int main()
{
    int i, j;
    scanf("%s", s);
    int len = strlen(s);
    for(i = 0; i < len; i++)
        if(s[i] == '0') break;
    for(j = 0; j < len; j++)
        if(i != j) printf("%c", s[j]);
    puts("");
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define LL __int64
char s[100005];
int main()
{
    int i, j;
    scanf("%s", s);
    int len = strlen(s);
    for(i = 0; i < len; i++)
        if(s[i] == '0') break;
    if(i == len) i = 0;
    for(j = 0; j < len; j++)
        if(i != j) printf("%c", s[j]);
    puts("");
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s,ans;
    cin >> s;

    bool f = 0;
    for(int i = 0; i < s.size(); ++i)
        if(s[i] == '1' || f)
            ans += s[i];
        else
            f = 1;
    if(!f)
        for(int i = 0; i < ans.size() - 1; ++i)
            cout << 1;
    else
        cout << ans;
    return 0;
}


/*
 * File:      main.cpp
 * Author:    Hrayr [HarHro94]
 * Problem:
 * IDE:       Visual C++ 2012
 */
#pragma comment(linker, "/STACK:66777216")
#define _CRT_SECURE_NO_WARNINGS
#include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cassert>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using namespace std;

typedef long long LL;
typedef long double LD;
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

const int N = 100007;
char st[N];

int main()
{
#ifdef harhro94
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    scanf("%s", st);
    int n = strlen(st);
    int p = -1;
    for (int i = 0; i < n; ++i)
    {
        if (st[i] == '0')
        {
            p = i;
            break;
        }
    }
    if (p == -1)
    {
        puts(st + 1);
    }
    else
    {
        for (int i = 0; i < n; ++i)
        {
            if (i != p)
            {
                printf("%c", st[i]);
            }
        }
    }

#ifdef harhro94
    cerr << fixed << setprecision(3) << "\nExecution time = " << clock() / 1000.0 << "s\n";
#endif
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main() {
    string a;
    cin>>a;
    for(int i=0; i<a.size(); ++i) {
        if(a[i]=='0') {
            a.erase(a.begin()+i);
            goto ohi;
        }
    }
    a.erase(a.begin());
ohi:;
    cout<<a<<'\n';
}


#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	string s;
	cin >> s;

	string out = "";
	bool is = false;
	for (int i=0; i < s.size(); i++) {
		if (!is && s.at(i) == '0') {
			is = true;
			continue;
		}
		out = out + s.at(i);
	}
	if (!is) {
		for (int i=0; i<out.size()-1;i++)
			cout << "1";
		cout << endl;
	}
	else
		cout << out << endl;
}


#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	string s;
	cin >> s;

	bool is = false;
	for (int i=0; i < s.size(); i++) {
		if (s.at(i) == '0') {
			cout << string(i, '1') << s.substr(i+1, s.size()) << endl;
			return 0;
		}
	}

	cout << string(s.size()-1, '1') << endl;
}


#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	string s;
	cin >> s;

	string out = "";
	bool is = false;
	for (int i=0; i < s.size(); i++) {
		if (!is && s.at(i) == '0') {
			is = true;
			continue;
		}
		out = out + s.at(i);
	}
	cout << out << endl;
}


#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	string s;
	cin >> s;

	string out = "";
	bool is = false;
	for (int i=0; i < s.size(); i++) {
		if (!is && s.at(i) == '0') {
			is = true;
			continue;
		}
		out = out + s.at(i);
	}
	if (!is) {
		cout << string(out.size()-1, '1') << endl;
		// for (int i=0; i<out.size()-1;i++)
		// 	cout << "1";
		// cout << endl;
	}
	else
		cout << out << endl;
}


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

char digit[100005];

int main() {
    scanf("%s", digit);

    int sz = strlen(digit);
    if (count(digit, digit + sz, '1') == sz) {
        digit[sz - 1] = 0;
        printf("%s\n", digit);
        return 0;
    }

    bool foundzero = 0;
    for (int i = 0; i < sz; ++i) {
        if (digit[i] == '0' && !foundzero) {
            foundzero = 1;
            continue;
        }
        printf("%c", digit[i]);
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    int i, n = 0, s;
    char a[100001];
    scanf("%s", a);
    s = strlen(a);
    for (i = 0; i < s; i++)
    {
        if (a[i] == '0')
        {
            n = i;
            break;
        }
    }
    if (n == 0)
    {
        for (i = 0; i < s-1; i++)
        {
            cout << a[i];
        }
    }
    else
    {
        for (i = 0; i < s; i++)
        {
            if (i == n)
                continue;
            cout << a[i];
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <cmath>
#include <algorithm>
#include <deque>
using namespace std;

int main()
{
    string s;
    cin>>s;
    bool f=true;
    for(int i=0;i<s.size();++i)
    {
        if(s[i]=='0')
        {
            s[i]='*';
            f=false;
            break;
        }
    }
        if(f)
        {
            for(int i=0;i<s.size()-1;++i)
                printf("%c",s[i]);
            cout<<endl;
            return 0;
        }
        else
            {
            for(int i=0;i<s.size();++i)
                if(s[i]!='*')
                printf("%c",s[i]);
            cout<<endl;
            return 0;
        }
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <string>
#include <limits>
#include <string.h>
#include <math.h>
#include <stack>
#include <map>
#include <functional>
using namespace std;

int main(){
  bool ok = false;
  string res = "";
  string sp = "";
  cin>>sp;
  for(int i = 0; i < sp.size(); ++i){
    if(sp[i] == '0'){
      res = sp.substr(0, i);
      res += sp.substr(i + 1, sp.size());
      ok = true;
      break;
    }
  }
  if(!ok){
    cout<<sp.substr(1, sp.size())<<endl;
  }
  else cout<<res<<endl;
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stdio.h>
#include <vector>
#include <queue>

using namespace std;

#define sb substr
#define pb push_back
#define si size
#define e empty

string s;
int n, i, j;
bool used[100005];

int main() {
  cin >> s;
  n = s.length();
  i = 0;
  while(i < n - 1 && s[i] != '0'){
	i++;
  }
  used[i] = true;
  for(i = 0; i < n; ++i){
	  if(!used[i]){
		  cout << s[i];
	  }
  }
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stdio.h>
#include <vector>
#include <queue>

using namespace std;

#define sb substr
#define pb push_back
#define si size
#define e empty

string s;
int n, i, j;
bool used[100005];

int main() {
  cin >> s;
  n = s.length();
  i = 0;
  while(i < n && s[i] != '0'){
	i++;
  }
  used[i] = true;
  for(i = 0; i < n; ++i){
	  if(!used[i]){
		  cout << s[i];
	  }
  }
}


#include <iostream>
#include <cstring>

using namespace std;

int main(){
	string s;
	cin >> s;
	bool f = false;
	for ( int i = 0; i < (int)s.length(); i++ ){
		if ( f )
			s[i - 1] = s[i];
		if ( !f && s[i] == '0' ){
			f = true;
		}
	}
	for ( int i = 0; i < (int)s.length() - 1; i++ )
		cout << s[i];
	return 0;
}


#include <iostream>
using namespace std;
string grid[8];
int main() {
    string s;
    cin>>s;
    int f=0;
    for(int i=0;i<s.size();++i)
    {
        if(s[i]=='0')
        {
            f=1;
            s[i]='2';break;
        }
    }
    if(f==0)
    {
        for(int i=0;i<s.size()-1;++i)
        {
            cout<<s[i];
        }
    }
    else
    {
        for(int i=0;i<s.size();++i)
        {
            if(s[i]!='2')cout<<s[i];
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int l = s.size();
    for (int i = 1; i < l; i++)
    {
        if (s[i] == '0')
        {
            s.erase(s.begin()+i);
            break;
        }
        else if (i == l-1)
            s.erase(s.begin()+i);
    }
    cout << s;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <list>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <set>
#include <map>
#include <vector>
#include <deque>
#include <queue>
#include <climits>
#include <unordered_map>
#define all(v) v.begin(), v.end()
#define ll long long
#define READ(f) freopen (f, "r", stdin)
#define WRITE(f) freopen (f, "w", stdout)
#define pb push_back
#define mp make_pair
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define inc(i, x, n) for(int i=(int)x;i<=(int)n;i++)
#define dec(i, n, x) for(int i=(int)n;i>=(int)x;i--)
#define F first
#define S second

using namespace std;

const int MAXN = 1e6 + 256;
const int N = 1256;
const int INF = int (1e9);

string s;
int mn = INF;

int main () {
    ios_base :: sync_with_stdio (false);
    #ifdef accepted
        READ(".in");
    #endif

    cin >> s;

    for (int i = 0; i < s.size(); ++i) {
        mn = min (int(s[i]), mn);
    }
    bool b = 1;
    for (int i = 0; i < s.size(); ++i) {
        if (int (s[i]) == mn && b) {
            b = 0;
            continue;
        }
        cout << s[i];
    }

    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>

using namespace std;

int main()
{
    char entering[10];
    cin >> entering;
int controller;

    for(int i=0; i<=strlen(entering)-1; i++) {

        if(entering[i]=='0'){
             controller = i;
             break;
        }

    }

    for(int j=controller; j<=strlen(entering)-2; j++) {
        entering[j] = entering[j+1];

    }

int exiting;
    exiting = atoi(entering);
    exiting = exiting - exiting%10;
    exiting/=10;
    cout << exiting;

    return 0;
}


#include <iostream>
#include <cstring>

#include <ctime>

using namespace std;

int main()
{
    char entering[100000];
    cin >> entering;
int controller=-1;

    for(int i=0; i<=strlen(entering)-1; i++) {

        if(entering[i]=='0'){
             controller = i;
             break;
        }
    }

    if(controller==-1){
        for(int j=0; j<=strlen(entering)-2; j++) {
        entering[j] = entering[j+1];
        }
    }
    else {
    for(int j=controller; j<=strlen(entering)-2; j++) {
        entering[j] = entering[j+1];
        }
}
    for(int k=0; k<=strlen(entering)-1; k++){
        if(k!=strlen(entering)-1)
        cout << entering[k];
    }

    cout << clock();

    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>

using namespace std;

int main()
{
    char entering[100000];
    cin >> entering;
int controller=-1;

    for(int i=0; i<=strlen(entering)-1; i++) {

        if(entering[i]=='0'){
             controller = i;
             break;
        }

    }

    if(controller==-1){
        for(int j=0; j<=strlen(entering)-2; j++) {
        entering[j] = entering[j+1];
        }
    }

    for(int j=controller; j<=strlen(entering)-2; j++) {
        entering[j] = entering[j+1];

    }

    for(int k=0; k<=strlen(entering)-1; k++){
        if(k!=strlen(entering)-1)
        cout << entering[k];
    }

    return 0;
}


#include <iostream>
#include <cstring>

#include <ctime>

using namespace std;

int main()
{
    char entering[100000];
    cin >> entering;
int controller=-1;

    for(int i=0; i<=strlen(entering)-1; i++) {

        if(entering[i]=='0'){
             controller = i;
             break;
        }
    }

    if(controller==-1){
        for(int j=0; j<=strlen(entering)-2; j++) {
        entering[j] = entering[j+1];
        }
    }
    else {
    for(int j=controller; j<=strlen(entering)-2; j++) {
        entering[j] = entering[j+1];
        }
}
    for(int k=0; k<=strlen(entering)-1; k++){
        if(k!=strlen(entering)-1)
        cout << entering[k];
    }

    return 0;
}


#include <iostream>
#include <cstring>

#include <ctime>

using namespace std;

int main()
{
    char entering[100000];
    cin >> entering;
int controller=-1;
int l = strlen(entering);

    for(int i=0; i<=l-1; i++) {

        if(entering[i]=='0'){
             controller = i;
             break;
        }
    }

    if(controller==-1){
        for(int j=0; j<=l-2; j++) {
        entering[j] = entering[j+1];
        }
    }
    else {
    for(int j=controller; j<=l-2; j++) {
        entering[j] = entering[j+1];
        }
}
    for(int k=0; k<=l-1; k++){
        if(k!=l-1)
        cout << entering[k];
    }

    return 0;
}


#include <vector>
#include <string>
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;

    int p = 0;
    for(int i = 1; i < s.size(); i++) {
        if(s[i] > s[p]) {
            break;
        }
        if(s[p] > s[i]) {
            p = i;
        }
    }

    for(int i = 0; i < s.size(); i++) {
        if(i != p)
            cout << s[i];
    }
    cout << endl;

    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:666000000")

#define bublic public

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <set>
#include <string>
#include <time.h>
#include <vector>

#define nextLine() {for(int c=getchar(); c!='\n' && c!=EOF; c=getchar());}
#define sqr(a) ((a)*(a))
#define has(mask,i) (((mask) & (1<<(i))) == 0 ? false : true)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

#define TASK "file"

using namespace std;

#define pii pair<int,int>
#define mp(x, y) make_pair(x, y)
#define pb(_o_) push_back(_o_)

typedef long long LL;
typedef unsigned long long ULL;
typedef long double ldb;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<int> vb;
typedef vector<vi> vvb;
typedef list<int> li;
typedef multiset<int>::iterator siit;

const int inf = (1 << 30) - 1;
const ldb eps = 1e-9;
const ldb pi = fabs(atan2(0.0, -1.0));

#ifndef ONLINE_JUDGE
#define parr(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++)cout<<a[i][j]<<" ";puts("");}puts("");
#else
#define parr(a,n,m) for(int i=0;i<2;i++)i++;
#endif

void ML()
{
    int *ass;
    for (;;)
    {
        ass = new int[2500000];
        for (int i = 0; i < 2500000; i++)
            ass[i] = rand();
    }
}

string str;

void LoAd()
{
    cin >> str;
}

void SoLvE()
{
    bool ok = false;
    for (int i = 0; i < (int) str.size() - 1; i++)
    {
        if (!ok && '0' == str[i])
        {
            ok = true;
        }
        else
        {
            cout << str[i];
        }
    }
    if (ok)
        cout << str[str.size() - 1];
}

int main()
{
    srand( (int) time(NULL));
#ifndef ONLINE_JUDGE
    freopen(TASK".in","r",stdin);   freopen(TASK".out","w",stdout);
#endif
    LoAd();
    SoLvE();
    return 0;
}


#ifdef ONLINE_JUDGE
#include "bits/stdc++.h"
using namespace std;
#else
#include "header.h"
#include "debug.h"
#endif
#define sz(s) int((s).size())
#define clr(a) memset(a,0,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int(i)=0; (i)<(n);++(i))
#define ru(i,a,b) for(int(i)=a;(i)<=(b);++(i))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
typedef long long LL; typedef vector <int> vi; typedef pair<int,int> pii; typedef map <int,int> mii; template <class T> inline T sqr(T x) {return x*x;} inline int ins(int x,int y,int m,int n){return (x>=1&&x<=m&&y>=1&&y<=n);} template <class T> inline T gcd(T a,T b){return (!b? a : gcd(b,a%b));} template <class T> inline T ABS(T x){return ((x)>0?(x):(-(x)));}
const int N = 1 << 20;

string solve (string str) {
  int slen = str.size ();
  int pos = -1;
  for (int i = 0; i < slen; ++i) {
    if (str [i] == '0') {
      if (pos == -1) {
        pos = i;
      }
    }
  }
  if (pos == -1 || str[0] == '0') {
    return str.substr (1,slen);
  }
  string s = "";
  for (int i = 0; i < slen; ++i) {
    if (pos != i) {
      s += str[i];
    }
  }
  return s;
}

int main() {
  #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
  #endif
  cin.sync_with_stdio(0); cin.tie(0);
  string str;
  cin >> str;
  cout << solve (str) << '\n';
}


#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#define File_in(input) freopen(input, "r", stdin)
#define File_out(output) freopen(output, "w", stdout)
#define YES  cout << "YES" << endl
#define NO cout << "NO" << endl
#define FOR(i,b,n) for(int i=b; i<=n; i++)
#define RFOR(i,n,b) for(int i=n; i>=b; i--)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

int main()
{
  int z = 0;
  string t;
  cin >> t;
  for (int i = 0; i < t.length(); i++)
  {
      if (z == 0 && (t[i] == '0' || i == t.length()-1 && t[i] == '1'))
      {
          z++;
          continue;
      }
      else
      {
          cout << t[i];
      }
  }
}


#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#define File_in(input) freopen(input, "r", stdin)
#define File_out(output) freopen(output, "w", stdout)
#define YES  cout << "YES" << endl
#define NO cout << "NO" << endl
#define FOR(i,b,n) for(int i=b; i<=n; i++)
#define RFOR(i,n,b) for(int i=n; i>=b; i--)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

int main()
{
  int z = 0;
  string t;
  cin >> t;
  if (t.find('0') == string::npos)
  {

      t.pop_back();
      cout << t << endl;
      return 0;
  }
  for (int i = 0; i < t.length(); i++)
  {
      if (z == 0 && t[i] == '0')
      {
          z++;
          continue;
      }
      else
      {
          cout << t[i];
      }
  }

}


#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#define File_in(input) freopen(input, "r", stdin)
#define File_out(output) freopen(output, "w", stdout)
#define YES  cout << "YES" << endl
#define NO cout << "NO" << endl
#define FOR(i,b,n) for(int i=b; i<=n; i++)
#define RFOR(i,n,b) for(int i=n; i>=b; i--)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

int main()
{
  int z = 0;
  string t;
  cin >> t;
  for (int i = 0; i < t.length(); i++)
  {
      if (z == 0 && t[i] == '0')
      {
          z++;
          continue;
      }
      else
      {
          cout << t[i];
      }
  }

}


#include <stdio.h>

char str[110000];
unsigned int i;

int main(){
	gets(str);
	for(i=0;str[i+1];++i){
		if(str[i]=='0'){
			puts(str+(++i));
			return 0;
		}else{
			putchar('1');
		}
	}
}


#include <cstdio>

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string input;
    cin >> input;
    size_t pos = input.find_first_of('0');
    if (pos != string::npos) {
        string res = input.substr(0, pos) + input.substr(pos + 1);
        cout << res << endl;
    } else {
        cout << input.substr(1) << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl "\n"
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define fname ""

using namespace std;

const int MaxN = int (1e5);
const int INF = int(1e9);

string s;
int pos;

int main () {
    ios_base :: sync_with_stdio (false);
//  freopen (fname".in","r",stdin);
//  freopen (fname".out","w",stdout);
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '0') {
            pos = i;
            break;
        }
    }
    for (int i = 0; i < s.size(); ++i)  {
        if (i != pos) {
            cout << s[i];
        }
    }
    return 0;
}


#include <iostream>
#include <sstream>
#include <vector>
#include <deque>
#include <algorithm>
using namespace std;

void solve(istream &in, ostream &out)
{
  string str;
  in >> str;
  auto a = str.find('0');
  if (a != string::npos)
    str.erase(a, 1);
  else
    str.resize(str.size() - 1);
  out << str << endl;
}

int main() {
  solve(cin, cout);
  return 0;
}


#include <iostream>
#include<cstdio>
#include<math.h>
#include <cmath>
#include<cstring>

using namespace std;

char str[1000000] ={'0'};

int main()
{
    int counter = 0 , flag = 0 ;
    scanf("%s",str);
    while(str[counter+1] != '\0')
    {
        if (str[counter] == '0' && flag == 0)
        {
            flag = 1;
        }
        else
        {
            printf("%c",str[counter]);
        }
        counter++;
    }
    if(flag == 0)
    {
        //do nothing
    }
    else
    {
        printf("%c",str[counter]);
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
// Input macros
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount
#define gcd                         __gcd

// Useful container manipulation / traversal macros
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

using namespace std;

int main()
{
    string str;
    int i;
    cin>>str;
    int f=0;
    for(i=0;i<str.length();++i)
    {
        if(str[i]=='1')
            f=1;
        if(f==1 && str[i]=='0')
            break;
    }

    if(i!=str.length())
    {
        for(int j=0;j<i;++j)
            cout<<str[j];
        for(int j=i+1;j<str.length();++j)
            cout<<str[j];
    }
    else
    {
        for(i=0;i<str.length()-1;++i)
            cout<<str[i];
    }

    cout<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
// Input macros
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

// Useful constants
#define INF                         (int)1e9
#define EPS                         1e-9

// Useful hardware instructions
#define bitcount                    __builtin_popcount
#define gcd                         __gcd

// Useful container manipulation / traversal macros
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair

// Some common useful functions
#define checkbit(n,b)                ( (n >> b) & 1)
#define DREP(a)                      sort(all(a)); a.erase(unique(all(a)),a.end())
#define INDEX(arr,ind)               (lower_bound(all(arr),ind)-arr.begin())

using namespace std;

int main()
{
    string str;
    int i;
    cin>>str;
    int f=0;
    for(i=0;i<str.length();++i)
    {
        if(str[i]=='1')
            f=1;
        if(f==1 && str[i]=='0')
            break;
    }

    if(i!=str.length())
    {
        for(int j=0;j<i;++j)
            cout<<str[j];
        for(int j=i+1;j<str.length();++j)
            cout<<str[j];
    }
    cout<<endl;

    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;

int i,n;
char s[100005];
main(){
   scanf("%s",s);
   int c = 0;
   for(i=0;i<strlen(s)-1;i++){
        if(s[i] == '1') printf("1");
        else{
            if(c > 0) printf("0");
            c++;
        }
   }
   if(c == 0) return 0;
   else printf("%c\n",s[strlen(s)-1]);
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;

int i,n;
char s[200005];
main(){
   scanf("%s",s);
   int c = 0, n = strlen(s);
   for(i=0;i<n-1;i++){
        if(s[i] == '1') printf("1");
        else{
            if(c > 0) printf("0");
            c++;
        }
   }
   if(c == 0) return 0;
   else printf("%c\n",s[n-1]);
}


#include <iostream>
#include <string>
using namespace std;

int main()
{
    string a;
    bool flag = true;
    cin >> a;
    for (int i=0; i<a.length(); i++)
        if (a.at(i) == '0')
        {
            a.erase(i, 1);
            flag = false;
            break;
        }

    if (flag)
        a.erase(0, 1);

    cout << a;
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<functional>
#include<algorithm>
#include<set>
#include<queue>

using namespace std;

typedef long long ll;

int main()
{

    string s;
    cin >> s;
    bool yes = false;
    for(int i=0;i<s.length();++i)
    {
        if(s[i]=='0')
        {
            s[i] = '-';
            yes = true;
            break;
        }
    }
    if(!yes) s[s.length()-1] = '-';
    for(int i=0;i<s.length();++i)
    {
        if(s[i]=='0' || s[i]=='1') cout << s[i];
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long            int64;
typedef pair<double, double> pdd;
typedef pair<int,  int>      pii;
typedef pair<int64,int64>    pii64;
typedef unsigned long long   uint64;
typedef vector<double>       vd;
typedef vector<int64>        vi64;
typedef vector<int>          vi;
typedef vector<vi>           vvi;

const double eps = 1e-11;
const double pi  = acos(-1.0);
const int    p   = 1000000007;
int countbit(int n){return n == 0 ? 0: countbit(n / 2) + n % 2;}
int lowbit  (int n){return (n ^ (n-1) ) & n;}
int64 gcd(int64 a, int64 b){ return b == 0? a : gcd(b, a % b);}
int64 lcm(int64 a, int64 b){ return a * b / gcd(a, b);}
int64 toInt64(string s){ istringstream sin(s); int64 t; sin >> t; return t;}
string toStr(int64 t)  { stringstream sin; sin << t; string s; sin >> s; return s;}
template<typename T> T sqr(T n){return n * n;}
template<typename T> void out(T& v){for(int i = 0; i < v.size(); i++) cout << v[i] << ' '; cout << endl;}

#define all(a)  (a).begin(), (a).end()
#define pb      push_back

class Timer
{
public:
    double start;
    Timer(){start = static_cast<double>(clock());}
    void out(){ cout << "TIME: " << (clock() - start) / CLOCKS_PER_SEC << endl;}
};

//#define FILE_INPUT

void solve()
{
  string s;
  cin >> s;
  size_t pos = s.find('0');
  if (pos == string::npos)
  {
    cout << string(s.size()-1, '1') << endl;
    return;
  }
  for(int i = 0; i < s.size(); ++i)
    if(i != pos)
      cout << s[i];
  cout <<endl;
}

int main(){
#ifndef ONLINE_JUDGE
    Timer timer;
#endif
#ifdef FILE_INPUT
    freopen("input.txt",  "r", stdin );
    freopen("output.txt", "w", stdout);
#endif
    cout.sync_with_stdio(false);
    cin. sync_with_stdio(false);
  solve();
#ifdef FILE_INPUT
    fclose(stdin);
    fclose(stdout);
#endif
#ifndef ONLINE_JUDGE
    cout << endl << endl;
    timer.out();
    cin.get();
#endif
    return EXIT_SUCCESS;
}


#include<bits/stdc++.h>
using namespace std;
#define MX 1000000
long long ar[MX+100],ar2[MX+100];
int main()
{
    int i,j,k;
    string s,s2;
    cin>>s;
    int ln=s.size();
    int pos=ln-1;

    for(i=pos;i>=1;i--)
    {
        if(s[i]=='1' && s[i-1]=='0'){pos=i-1;}
    }
    //cout<<pos;
    for(i=0;i<ln;i++)
    {
        if(i==pos)continue;
        cout<<s[i];
    }
    cout<<endl;

   //main();
//    return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define MX 1000000
long long ar[MX+100],ar2[MX+100];
int main()
{
    int i,j,k;
    string s,s2;
    cin>>s;
    int ln=s.size();
    int pos=ln-1;

    for(i=pos;i>=1;i--)
    {
        if(s[i]=='1' && s[i-1]=='0'){pos=i-1; break;}
    }
    //cout<<pos;
    for(i=0;i<ln;i++)
    {
        if(i==pos)continue;
        cout<<s[i];
    }
    cout<<endl;

   main();
//    return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define MX 1000000
long long ar[MX+100],ar2[MX+100];
int main()
{
    int i,j,k;
    string s,s2;
    cin>>s;
    int ln=s.size();
    int pos=ln-1;

    for(i=pos;i>=1;i--)
    {
        if(s[i]=='1' && s[i-1]=='0'){pos=i-1; break;}
    }
    //cout<<pos;
    for(i=0;i<ln;i++)
    {
        if(i==pos)continue;
        cout<<s[i];
    }
    cout<<endl;

   //main();
//    return 0;

}


//
//  CR_157_Div2_C.cpp
//  Codeforces
//
//  Created by Nguyen Tat Thang on 22/12/12.
//  Copyright (c) 2012 nguy0035. All rights reserved.
//

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <string>
#include <stdio.h>

using namespace std;

const int maxN = 100005;
char f[maxN];

int main()
{
    gets(f);
    int len = strlen(f);
    int firstZero = -1;

    for (int i=0;i<len;i++)
        if (f[i]=='0')
        {
            firstZero = i;
            break;
        }

    if (firstZero==-1)
    {
        for (int i=0;i<len-1;i++)
            printf("%c\n",f[i]);

        return 0;
    }
    else
    {
        for (int i=0;i<firstZero;i++)
            printf("%c",f[i]);
        for (int i=firstZero+1;i<len;i++)
            printf("%c",f[i]);

        return 0;
    }
}


//
//  CR_157_Div2_C.cpp
//  Codeforces
//
//  Created by Nguyen Tat Thang on 22/12/12.
//  Copyright (c) 2012 nguy0035. All rights reserved.
//

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <string>
#include <stdio.h>

using namespace std;

const int maxN = 100005;
char f[maxN];

int main()
{
    gets(f);
    int len = strlen(f);
    int firstZero = -1;

    for (int i=0;i<len;i++)
        if (f[i]=='0')
        {
            firstZero = i;
            break;
        }

    if (firstZero==-1)
    {
        for (int i=0;i<len-1;i++)
            printf("%c",f[i]);

        return 0;
    }
    else
    {
        for (int i=0;i<firstZero;i++)
            printf("%c",f[i]);
        for (int i=firstZero+1;i<len;i++)
            printf("%c",f[i]);

        return 0;
    }
}


#include<stdio.h>
#include<string.h>
#define INF 100010
char s[INF];
int main(){
    int i,len,flag,first=1;
    scanf("%s",s);
    len=strlen(s);
    for(i=0;i<len;i++)
        if(first==1&&s[i]!='0'){
            first=i;
            break;
        }
    for(i=first;i<len;i++)
        if(s[i]=='0'){
            flag=i;
            break;
        }
    for(i=first;i<len;i++)
        if(i!=flag)printf("%c",s[i]);
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
    int i,j,k=0,l,mi=100001;
    char a[100001];
    scanf("%s",a);
    l=strlen(a);
    for(i=l-1;i>=0;i--)
    {
        if(a[i]=='0')
        {
            k++;
            if(i<mi)
                mi=i;
        }
    }
    if(k==0)
        for(i=1;i<l;i++)
        printf("%c",a[i]);
    else
        for(i=0;i<l;i++)
        {
        if(i!=mi)
            printf("%c",a[i]);
        }
        return(0);
}


#include <stdio.h>
#include<string.h>
int tonumber(char *array, int delete)
{
	int i, temp, total=0;
	for(i=0; *(array+i)!='\0'; i++)
	{
		if (i!=delete)
		{
			temp=(*(array+i)-'0');
			total=total*2+temp;
		}
	}
	return total;
}

int main ()
{
	char input[30], output[30];
    int number, max=0;
	int length,i,j,z;
	gets(input);

	for(i=0; input[i]!='\0'; i++)
	{
		number=tonumber(input, i);
		if(number>max)
		{
		    max=number;
			z=0;
			for(j=0; input[j]!='\0'; j++)
			{
				if (j!=i)
					output[z++]=input[j];
			}
			output[j]='\0';
		}
	}
	printf("%s\n", output);
}


#include <stdio.h>
#include<string.h>
int tonumber(char *array, int delete)
{
	int i, temp, total=0;
	for(i=0; *(array+i)!='\0'; i++)
	{
		if (i!=delete)
		{
			temp=(*(array+i)-'0');
			total=total*2+temp;
		}
	}
	return total;
}

int main ()
{
	char input[30], output[30];
    int number, max=0;
	int length,i,j,z;
	gets(input);
	if(strlen(input)==1)
		return 0;
	for(i=0; input[i]!='\0'; i++)
	{
		number=tonumber(input, i);
		if(number>max)
		{
		    max=number;
			z=0;
			for(j=0; input[j]!='\0'; j++)
			{
				if (j!=i)
					output[z++]=input[j];
			}
			output[z]='\0';
		}
	}
	printf("%s", output);
	return 0;
}


#include <stdio.h>
#include<string.h>
long long int tonumber(char *array, int delete)
{
	int i, temp;
	long long total=0;
	for(i=0; *(array+i)!='\0'; i++)
	{
		if (i!=delete)
		{
			temp=(*(array+i)-'0');
			total=total*2+temp;
		}
	}
	return total;
}

int main ()
{
	char input[1000000], output[1000000];
    long long int number, max=0;
	int length,i,j,z;
	gets(input);
	if(strlen(input)==1)
		return 0;
	for(i=0; input[i]!='\0'; i++)
	{
		number=tonumber(input, i);
		if(number>max)
		{
		    max=number;
			z=0;
			for(j=0; input[j]!='\0'; j++)
			{
				if (j!=i)
					output[z++]=input[j];
			}
			output[z]='\0';
		}
	}
	printf("%s", output);
	return 0;
}


#include <stdio.h>
#include<string.h>
int main ()
{
	char input[100001], delete[100001], max[100001];
	int i,j,z;
	gets(input);
	for (i=0; i<100001; i++)
	max[i]=0;
	for(i=0; input[i]!='\0'; i++)
	{
		z=0;
		for(j=0; input[j]!='\0'; j++)
		{
			if (j!=i)
				delete[z++]=input[j];
		}
		delete[z]='\0';
		if(strcmp(max, delete)<0)
           strcpy(max, delete);
	}
	printf("%s", max);
	return 0;
}


n,k = int(input()),input()
l = list(map(int,input().split()))
h = [(l[i+1]-l[i])//2 for i in range(n-1) if k[i]=='R' and k[i+1]=='L' ]
if len(h)==0:print(-1)
else:print(min(h))


n = int(input())
moves = [i for i in input()]
positions = list(map(int, input().split()))

collision = False
i = 0

while(not collision and i < n):
    if moves[i] == 'L':
        positions[i]-=1
    else:
        positions[i]+=1
    print(positions)
    if (len(set(positions)) < 4):
        collision = True
    i+=1

if collision:
    print(i - 1)
else:
    print(-1)


n = int(input())
m = input()
moves = [i for i in m]
positions = list(map(int, input().split()))

if not 'RL' in m:
    print(-1)
else:
    mini = positions[-1] - positions[0]
    for i in range(n-1):
        if moves[i] == 'R' and moves[i+1] == 'L':
            mini = min(mini, positions[i+1] - positions[i])

    print(int(mini/2))


n = int(input())
m = input()
moves = [i for i in m]
positions = list(map(int, input().split()))

if not 'RL' in m:
    print(-1)
else:
    collision = False
    i = 0
    counter = 1
    while(not collision):
        if moves[i] == 'L':
            positions[i]-=1
        else:
            positions[i]+=1
        if (len(set(positions)) < n):
            collision = True
        i = (i+1) % n
        if i == 0:
            counter+=1

    if collision:
        print(counter)


n = int(input())
moves = [i for i in input()]
positions = list(map(int, input().split()))

collision = False
i = 0

while(not collision and i < n):
    if moves[i] == 'L':
        positions[i]-=1
    else:
        positions[i]+=1
    if (len(set(positions)) < n):
        collision = True
    i+=1

if collision:
    print(i - 1)
else:
    print(-1)


n = int(input())
moves = [i for i in input()]
positions = list(map(int, input().split()))

collision = False
i = 0

while(not collision and i < n):
    if moves[i] == 'L':
        positions[i]-=1
    else:
        positions[i]+=1
    if (len(set(positions)) < 4):
        collision = True
    i+=1

if collision:
    print(i - 1)
else:
    print(-1)


# Name : Sachdev Hitesh
# College : GLSICA

rg = int(input())
user = input()
a = map(int,input().split())
ans = [];flag=False
for i in range(rg-1):
	if user[i]=='R' and user[i+1]=='L':
		b = a[i+1]-a[1]
		ans.append(b)
		flag = True
if flag==True:
	print(min(ans)/2)
else:
	print(-1)


# Name : Sachdev Hitesh
# College : GLSICA

rg = int(input())
user = input()
a = list(map(int,input().split()))
ans = [];flag=False
for i in range(rg-1):
	if user[i]=='R' and user[i+1]=='L':
		b = a[i+1]-a[i]
		ans.append(b)
		flag = True
if flag:
	print(int(min(ans)/2))
else:
	print(-1)


n = int(input())
s = input()
a = list(map(int,input().split()))

if "L" not in s:
    print(-1)
    exit(0)
if "R" not in s:
    print(-1)
    exit(0)

ans = []
f = 0
for i in range(n):
    if s[i] == "R":
        right = a[i]
        f = 1
    elif f and s[i] == "L":
        left = a[i]
        f = 0
        ans.append([right,left])

m= 10**5
if ans:
    for i in ans:
        val = abs(i[0]-i[1])
        if val<m:
            m = val
    print(m//2)
else:
    print(-1)


n = int(input())
s = input()
a = list(map(int,input().split()))

if "L" not in s:
    print(-1)
    exit(0)
if "R" not in s:
    print(-1)
    exit(0)

ans = []
f = 0
for i in range(n):
    if s[i] == "R":
        right = a[i]
        f = 1
    elif f and s[i] == "L":
        left = a[i]
        f = 0
        ans.append([right,left])

m= 10**10
if ans:
    for i in ans:
        val = abs(i[0]-i[1])
        if val<m:
            m = val
    print(m//2)
else:
    print(-1)


n = int(input())
s = input()
a = list(map(int,input().split()))

if "L" not in s:
    print(-1)
    exit(0)
if "R" not in s:
    print(-1)
    exit(0)

ans = []
flag = 0
for i in range(n):
 if s[i] == "R":
        r = a[i]
        flag = 1
    elif flag and s[i] == "L":
        l = a[i]
        flag = 0
        ans.append([r,l])

min = 10**5
if ans:
    for i in ans:
        val = abs(i[0]-i[1])
 if val<min:
            min = val
    print(min//2)
else:
    print(-1)


n = int(input())
r = input()
s = [int(i) for i in input().split()]

if r.count("RL"):
	for i in range(n-1):
		if r[i]=="R" and r[i+1]=="L":
			print((s[i+1]-s[i])//2)
			break
else:
	print(-1)


n = int(input())
r = input()
s = [int(i) for i in input().split()]
c = 10**9+1

if r.count("RL"):
	for i in range(n-1):
		if r[i]=="R" and r[i+1]=="L":
			c = min(((s[i+1]-s[i])//2),c)
	print(c)
else:
	print(-1)


x=int(input())
y=list(input())
p=list(map(int,input().split()))
mi=p[x-1]
for i in range(x-1):
    if y[i]=="R" and y[i+1]=="L":
        mi=min(mi,p[i+1]-p[i])
print(mi//2 if mi!=p[x-1] else -1)


x=int(input())
y=list(input())
p=list(map(int,input().split()))
mi=p[x-1]+1
for i in range(x-1):
    if y[i]=="R" and y[i+1]=="L":
        mi=min(mi,p[i+1]-p[i])
print(mi//2 if mi!=p[x-1]+1 else -1)


x=int(input())
y=list(input())
p=list(map(int,input().split()))
mi=p[x-1]
for i in range(x-1):
    if y[i]=="R" and y[i+1]=="L":
        if p[i+1]-p[i]>=1:mi=min(mi,p[i+1]-p[i])
print(mi//2 if mi!=p[x-1] else -1)


n = int(input())
moves = input()
positions = list(map(int, input().split(' ')))
ans = 10 ** 9
for i in range(n-1):
        if moves[i] = 'R' and moves[i+1] = 'L':
                ans = min(ans, (positions[i+1] - positions[i]) // 2)
if ans == 10 ** 9:
        print(-1)
else:
        print(ans)


n = int(input())
moves = input()
positions = list(map(int, input().split(' ')))
ans = 10 ** 9
for i in range(n-1):
        if moves[i] == 'R' and moves[i+1] == 'L':
                ans = min(ans, (positions[i+1] - positions[i]) // 2)
if ans == 10 ** 9:
        print(-1)
else:
        print(ans)


import sys
n = int(input())

directions = input()

coordinates = [int(x) for x in input().split()]

min_time = sys.maxsize * 2 + 1
max_r = -sys.maxsize * 2
for i in range(len(coordinates)):
    if directions[i] == 'L':
        if min_time > (coordinates[i] - max_r) // 2:
            min_time = (coordinates[i] - max_r) // 2
    else:
        max_r = coordinates[i]

if min_time > max(coordinates):
    print(-1)
else:
    print(max_r)