#include #include using namespace std; const int N = 100005; int a[N], b[N], f[N], vis[N]; void solve() { int n; scanf("%d", &n); for (int i=0; i