#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //eolibraries #define lnf 3999999999999999999 #define inf 999999999 #define fi first #define se second #define pb push_back #define ll long long #define ld long double #define all(c) (c).begin(),(c).end() #define sz(c) (int)(c).size() #define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end()) #define pii pair #define rep(i,n) for(int i = 0 ; i < n ; i++) #define drep(i,n) for(int i = n-1 ; i >= 0 ; i--) #define crep(i,x,n) for(int i = x ; i < n ; i++) #define vi vector #define vec(...) vector<__VA_ARGS__> #define _3yHSMG9 ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) //eodefine using namespace std; const int mxn=12000; int main(){ _3yHSMG9; int n; cin>>n; vec(pii) a(n); vi b(n); rep(i,n){ cin>>a[i].fi; a[i].se=i; } rep(i,n) cin>>b[i]; sort(all(a)); sort(all(b)); vec(pii) ans; auto f=[&](auto self,int i)->void{ if(a[i].fi>b[i]){ if(i and a[i-1].fi>=b[i]) self(self,i-1); else if(i==0){ while(a[i].fi!=b[i]){ a[i].fi--; ans.pb({1,a[i].se}); } } } while(a[i].fi!=b[i]){ if(b[i]>a[i].fi){ a[i].fi++; ans.pb({0,i}); }else{ a[i].fi--; ans.pb({1,i}); } } return; }; drep(i,n){ if(a[i].fi!=b[i]){ f(f,i); } } cout<