#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
typedef int64_t ll;
typedef long double ld;
typedef unsigned long long ULL;
#define endl "\n"
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
void read(vector<int> &a) {for (auto &x : a)cin >> x;}
void read(vector<ll> &a) {for (auto &x : a)cin >> x;}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c * x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
    ~debug() { cerr << endl; }
    eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int MOD = 1e9 + 7;
const int INF = (int)2e9 + 7;
const ll LINF = (ll)1e18;
const ld PI = 3.1415926535897932384626433832795;

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b) {
        cout << "=";
    }
    else if (abs(a) == abs(b)) {
        if (c % 2 == 0) {
            cout << "=";
        }
        else if (a > 0 && b < 0) {
            cout << ">";
        }
        else if (b > 0 && a < 0) {
            cout << "<";
        }
        else {
            assert(false);
        }
    }
    else if (a == 0 || b == 0) {
        if (a == 0 && b == 0) {
            cout << "=";
        }
        else if (a == 0) {
            if (b > 0) {
                cout << "<";
            }
            else if (b < 0 && c % 2 == 0) {
                cout << "<";
            }
            else {
                cout << ">";
            }
        }
        else {
            if (a > 0) {
                cout << ">";
            }
            else if (a < 0 && c % 2 == 0) {
                cout << ">";
            }
            else {
                cout << "<";
            }
        }
    }
    else if (a < 0 && b < 0) {
        if (c % 2 == 0) {
            if (abs(a) < abs(b)) {
                cout << "<";
            }
            else {
                cout << ">";
            }
        }
        else if (a < b) {
            cout << "<";
        }
        else {
            cout << ">";
        }
    }
    else if (a > 0 && b > 0) {
        if (a < b) {
            cout << "<";
        }
        else {
            cout << ">";
        }
    }
    else if (a < 0 && b > 0) {
        if (c % 2 == 0) {
            if (abs(a) > abs(b)) {
                cout << ">";
            }
            else {
                cout << "<";
            }
        }
        else {
            cout << "<";
        }
    }
    else if (a > 0 && b < 0) {
        if (c % 2 == 0) {
            if (abs(a) > abs(b)) {
                cout << ">";
            }
            else {
                cout << "<";
            }
        }
        else {
            cout << ">";
        }
    }
}

int32_t main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    auto t1 = high_resolution_clock::now();
    for (int tt = 1; tt <= t; tt++)
    {
        //cout << "Case #" << tt << ": ";
        solve();
    }
    auto t2 = high_resolution_clock::now();
    auto time = duration_cast<duration<double>>(t2 - t1);
    cerr << "Time elapsed = " << time.count() << endl;
}

/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
int N;
int a[SIZE];
int b[SIZE];
int p[SIZE];
int from[SIZE];
void solve() {
    VPII AA;
    FOR(i,1,N){
        if(p[i] != i && a[i] <= b[p[i]]) {
            W(-1);
            return;
        }
        AA.PB(MP(b[p[i]],p[i]));
    }
    sort(ALL(AA),greater<PII>());
    VPII an;
    REP(i,SZ(AA)){
        int x=AA[i].S;
        if(x==p[x])continue;
        int y=from[x];
        an.PB(MP(x,y));
        swap(p[x],p[y]);
        from[p[x]]=x;
        from[p[y]]=y;
    }
    W(SZ(an));
    for(auto x: an) {
        W(x);
    }
}
void input() {
    R(N);
    FOR(i,1,N)R(a[i]);
    FOR(i,1,N)R(b[i]);
    FOR(i,1,N){
        R(p[i]);
        from[p[i]]=i;
    }
}
int main(){
    input();
    solve();
    return 0;
}
