#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cmath>
#include <cstdlib>
#define sqr(x) (x)*(x)
using namespace std;

int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n,m,a[int(1e5+5)];
    pair<int,int> f[int(1e5+5)], b[int(1e5+5)];
    cin>>n>>m;
    for (int i=0; i<n; i++){
        cin>>f[i].first;
        f[i].second=i+1;
    }
    for (int i=0; i<m; i++){
        cin>>b[i].first;
        b[i].second=i+1;
    }
    sort(f,f+n);
    sort(b,b+m);
    for (int i=n-1, j=m-1; i>=0; i--){
        if (f[i].first!=b[j].first){
            if((j>=0 && f[i].first!=b[j-1].first) || j<0){
                cout<<"Impossible";
                return 0;
            }
            else j--;
        }
        a[b[j].second]=f[i].second;
    }
    for (int i=1; i<m; i++){
        if (b[i].first==b[i-1].first){
            cout<<"Ambiguity";
            return 0;
        }
    }
    cout<<"Possible"<<endl;
    for (int i=1; i<=m; i++) cout<<a[i]<<" ";
//    fclose(stdin);
//    fclose(stdout);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cmath>
#include <cstdlib>
#define sqr(x) (x)*(x)
using namespace std;

int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n,m,a[int(1e5+5)];
    pair<int,int> f[int(1e5+5)], b[int(1e5+5)];
    cin>>n>>m;
    for (int i=0; i<n; i++){
        cin>>f[i].first;
        f[i].second=i+1;
    }
    for (int i=0; i<m; i++){
        cin>>b[i].first;
        b[i].second=i+1;
    }
    sort(f,f+n);
    sort(b,b+m);
    int j=n-1;
    for (int i=m-1; i>=0 && j>=0; i--){
        while (j>=0 && b[i].first!=f[j].first) j--;
        a[f[j].second]=b[i].second;
    }
    if (j<0){
        cout<<"Impossible";
        return 0;
    }
    for (int i=1; i<n; i++){
        if (f[i].first==f[i-1].first){
            cout<<"Ambiguity";
            return 0;
        }
    }
    cout<<"Possible"<<endl;
    for (int i=1; i<=m; i++) cout<<a[i]<<" ";
//    fclose(stdin);
//    fclose(stdout);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cmath>
#include <cstdlib>
#define sqr(x) (x)*(x)
using namespace std;

int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n,m,a[int(1e5+5)];
    pair<int,int> f[int(1e5+5)], b[int(1e5+5)];
    cin>>n>>m;
    for (int i=0; i<n; i++){
        cin>>f[i].first;
        f[i].second=i+1;
    }
    for (int i=0; i<m; i++){
        cin>>b[i].first;
        b[i].second=i+1;
    }
    sort(f,f+n);
    sort(b,b+m);
    for (int i=n-1, j=m-1; i>=0 && j>=0; i--){
        if (f[i].first!=b[j].first){
            if(j>=0 && f[i].first!=b[j-1].first){
                cout<<"Impossible";
                return 0;
            }
            else j--;
        }
        a[b[j].second]=f[i].second;
    }
    for (int i=1; i<m; i++){
        if (b[i].first==b[i-1].first){
            cout<<"Ambiguity";
            return 0;
        }
    }
    cout<<"Possible"<<endl;
    for (int i=1; i<=m; i++) cout<<a[i]<<" ";
//    fclose(stdin);
//    fclose(stdout);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cmath>
#include <cstdlib>
#define sqr(x) (x)*(x)
using namespace std;

int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n,m,a[int(1e5+5)];
    pair<int,int> f[int(1e5+5)], b[int(1e5+5)];
    cin>>n>>m;
    for (int i=0; i<n; i++){
        cin>>f[i].first;
        f[i].second=i+1;
    }
    for (int i=0; i<m; i++){
        cin>>b[i].first;
        b[i].second=i+1;
    }
    sort(f,f+n);
    sort(b,b+m);
    int j=n-1;
    for (int i=m-1; i>=0 && j>=0; i--){
        while (j>=0 && b[i].first!=f[j].first) j--;
        if (j-1>=0 && f[j].first==f[i-1].first){
            cout<<"Ambiguity";
            return 0;
        }
        a[f[j].second]=b[i].second;
    }
    if (j<0){
        cout<<"Impossible";
        return 0;
    }
    cout<<"Possible"<<endl;
    for (int i=1; i<=m; i++) cout<<a[i]<<" ";
//    fclose(stdin);
//    fclose(stdout);
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <string.h>
#include <cmath>
#include <cstdlib>
#define sqr(x) (x)*(x)
using namespace std;

int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    int n,m,a[int(1e5+5)];
    pair<int,int> f[int(1e5+5)], b[int(1e5+5)];
    cin>>n>>m;
    for (int i=0; i<n; i++){
        cin>>f[i].first;
        f[i].second=i+1;
    }
    for (int i=0; i<m; i++){
        cin>>b[i].first;
        b[i].second=i+1;
    }
    sort(f,f+n);
    sort(b,b+m);
    int j=n-1;
    for (int i=m-1; i>=0 && j>=0; i--){
        while (j>=0 && b[i].first!=f[j].first) j--;
        if (j-1>=0 && f[j].first==f[j-1].first){
            cout<<"Ambiguity";
            return 0;
        }
        a[f[j].second]=b[i].second;
    }
    if (j<0){
        cout<<"Impossible";
        return 0;
    }
    cout<<"Possible"<<endl;
    for (int i=1; i<=m; i++) cout<<a[i]<<" ";
//    fclose(stdin);
//    fclose(stdout);
    return 0;
}


#include <iostream>
#define NMAX 100001

using namespace std;
int n, m;
int rs[NMAX]={0};
int a[NMAX]={0};
int c[NMAX]={0};

int solve()
{
    int b,flag=1;
    for (int i=0; i<m; i++)
    {
        cin>> b;
        if (c[b]==0)
            return -1;
        else if (c[b]==-1)
            flag=0;
        else
            rs[i]=a[b];
    }
    return flag;
}

int main()
{
    ios_base::sync_with_stdio(false);
    int i,x;
    cin>> n >> m;
    for (i=0; i<n; i++)
    {
        cin>> x;
        a[x]=i+1;
        if (c[x]==0)
            c[x]=1;
        else
            c[x]=-1;
    }
    x=solve();
    if (x==1)
    {
        cout<< "Possible\n";
        for (i=0; i<m; i++)
            cout<< rs[i] << " ";
    }
    else if (x==0)
        cout<< "Ambiguity\n";
    else
        cout<< "Impossible\n";
    return 0;
}


#include <iostream>
#define NMAX 100000

using namespace std;
int n, m, rs[NMAX], a[NMAX], c[NMAX]={0};

int solve()
{
    int b;
    for (int i=0; i<m; i++)
    {
        cin >> b;
        if (c[b]==0)
            return -1;
        else if (c[b]>=2)
            return 0;
        else
            rs[i]=a[b];
    }
    return 1;
}

int main()
{
    int i,x;
    cin >> n >> m;
    for (i=0; i<n; i++)
    {
        cin >> x;
        a[x]=i+1;
        c[x]++;
    }
    x=solve();
    if (x==1)
    {
        cout << "Possible" << endl;
        for (i=0; i<m; i++)
            cout << rs[i] << " ";
    }
    else if (x==0)
        cout << "Ambiguity" << endl;
    else
        cout << "Impossible" << endl;
    return 0;
}


#include <iostream>
#define NMAX 100000

using namespace std;
int n, m, rs[NMAX], a[NMAX], c[NMAX]={0};

int solve()
{
    int b,flag=1;
    for (int i=0; i<m; i++)
    {
        cin >> b;
        if (c[b]==0)
        {
            return -1;
        }
        else if (c[b]>=2)
        {
            if (flag!=-1)
                flag=0;
        }
        else
            rs[i]=a[b];
    }
    return flag;
}

int main()
{
    int i,x;
    cin >> n >> m;
    for (i=0; i<n; i++)
    {
        cin >> x;
        a[x]=i+1;
        c[x]++;
    }
    x=solve();
    if (x==1)
    {
        cout << "Possible" << endl;
        for (i=0; i<m; i++)
            cout << rs[i] << " ";
    }
    else if (x==0)
        cout << "Ambiguity" << endl;
    else
        cout << "Impossible" << endl;
    return 0;
}


#include <iostream>
#define NMAX 100001

using namespace std;
int n, m;
int rs[NMAX]={0};
int a[NMAX]={0};
int c[NMAX]={0};

int solve()
{
    int b,flag=1;
    for (int i=0; i<m; i++)
    {
        cin>> b;
        if (c[b]==0)
            return -1;
        else if (c[b]==-1)
            flag=0;
        else
            rs[i]=a[b];
    }
    return flag;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    int i,x;
    cin>> n >> m;
    for (i=0; i<n; i++)
    {
        cin>> x;
        a[x]=i+1;
        if (c[x]==0)
            c[x]=1;
        else
            c[x]=-1;
    }
    x=solve();
    if (x==1)
    {
        cout<< "Possible\n";
        for (i=0; i<m; i++)
            cout<< rs[i] << " ";
    }
    else if (x==0)
        cout<< "Ambiguity\n";
    else
        cout<< "Impossible\n";
    return 0;
}


#include <cstdio>
#define NMAX 100000

using namespace std;
int n, m, rs[NMAX]={0}, a[NMAX]={0}, c[NMAX]={0};

int solve()
{
    int b,flag=1;
    for (int i=0; i<m; i++)
    {
        scanf("%d",&b);
        if (c[b]==0)
            return -1;
        else if (c[b]==-1)
            flag=0;
        else
            rs[i]=a[b];
    }
    return flag;
}

int main()
{
    int i,x;
    scanf("%d%d",&n,&m);
    for (i=0; i<n; i++)
    {
        scanf("%d",&x);
        a[x]=i+1;
        if (c[x]==0)
            c[x]=1;
        else
            c[x]=-1;
    }
    x=solve();
    if (x==1)
    {
        printf("Possible\n");
        for (i=0; i<m; i++)
            printf("%d ",rs[i]);
    }
    else if (x==0)
        printf("Ambiguity\n");
    else
        printf("Impossible\n");
    return 0;
}


#include <cstdio>
#define NMAX 100001

using namespace std;
int n, m;
int rs[NMAX]={0};
int a[NMAX]={0};
int c[NMAX]={0};

int solve()
{
    int b,flag=1;
    for (int i=0; i<m; i++)
    {
        scanf("%d",&b);
        if (c[b]==0)
            return -1;
        else if (c[b]==-1)
            flag=0;
        else
            rs[i]=a[b];
    }
    return flag;
}

int main()
{
    int i,x;
    scanf("%d%d",&n,&m);
    for (i=0; i<n; i++)
    {
        scanf("%d",&x);
        a[x]=i+1;
        if (c[x]==0)
            c[x]=1;
        else
            c[x]=-1;
    }
    x=solve();
    if (x==1)
    {
        printf("Possible\n");
        for (i=0; i<m; i++)
            printf("%d ",rs[i]);
    }
    else if (x==0)
        printf("Ambiguity\n");
    else
        printf("Impossible\n");
    return 0;
}


#include <iostream>
#define NMAX 100000

using namespace std;
int n, m, rs[NMAX], a[NMAX], c[NMAX]={0};

int solve()
{
    int b,flag=1;
    for (int i=0; i<m; i++)
    {
        cin >> b;
        if (c[b]==0)
        {
            return -1;
        }
        else if (c[b]>=2)
        {
            if (flag!=-1)
                flag=0;
        }
        else
            rs[i]=a[b];
    }
    return flag;
}

int main()
{
    int i,x;
    cin >> n >> m;
    for (i=0; i<=n; i++)
        c[i]=0;
    for (i=0; i<n; i++)
    {
        cin >> x;
        a[x]=i+1;
        c[x]++;
    }
    x=solve();
    if (x==1)
    {
        cout << "Possible" << endl;
        for (i=0; i<m; i++)
            cout << rs[i] << " ";
    }
    else if (x==0)
        cout << "Ambiguity" << endl;
    else
        cout << "Impossible" << endl;
    return 0;
}


#include <iostream>
#define NMAX 100000

using namespace std;
int n, m, rs[NMAX], a[NMAX], c[NMAX]={0};

int solve()
{
    int b;
    for (int i=0; i<m; i++)
    {
        cin >> b;
        if (c[b]==0)
            return -1;
        else if (c[b]>=2)
            return 0;
        else
            rs[i]=a[b];
    }
    return 1;
}

int main()
{
    int i,x;
    cin >> n >> m;
    for (i=0; i<=n; i++)
        c[i]=0;
    for (i=0; i<n; i++)
    {
        cin >> x;
        a[x]=i+1;
        c[x]++;
    }
    x=solve();
    if (x==1)
    {
        cout << "Possible" << endl;
        for (i=0; i<m; i++)
            cout << rs[i] << " ";
    }
    else if (x==0)
        cout << "Ambiguity" << endl;
    else
        cout << "Impossible" << endl;
    return 0;
}


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

int n,m,u=1,c;
int main()
{
    cin>>n>>m;
    vector<int> a(m),f(n),b(m),tex(m);
    for(int i=1;i<=n;i++){
        cin>>f[i];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
        for(int j=1;j<=n;j++){
            if(b[i]==f[j]){
                a[i]=j;
                tex[i]++;
            }
        }
        if(a[i]==0) {cout<<"Impossible"; return 0;}
        else if(tex[i]>1) c++;
    }

    if(c==m) {cout<<"Ambiguity"; return 0;}

    cout<<"Possible"<<endl;
    for(int i=1;i<=m;i++) cout<<a[i]<<" ";

    return 0;
}


#include<iostream>
#include<vector>
#include<cstdio>

using namespace std;

int n,m,c,u;
int a[100021],f[100021],b[100021];
int main()
{
    cin>>n>>m;
    vector<int> c[n];

    for(int i=1;i<=n;i++) { cin>>f[i]; f[i]--; c[f[i]].push_back(i); }
    for(int i=1;i<=m;i++) { cin>>b[i]; b[i]--; }

    for (int i=1;i<=m;i++) {
        if (c[b[i]].size()==0) { cout<<"Impossible"; return 0; }
        if (c[b[i]].size()>1) { u=1; }

        a[i]=c[b[i]][0];
    }
    if(u==1){ cout<<"Ambiguity"; return 0; }
    else {
        cout<<"Possible"<<endl;
    for (int i=1;i<=m;i++)
        cout<<a[i]<<" ";
    }
    return 0;
}


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

int n,m,u=1,c;
int a[100001],f[100001],b[100001],tex[100001];
int main()
{
    cin>>n>>m;
    //vector<int> a(m),f(n),b(m),tex(m);
    for(int i=1;i<=n;i++){
        cin>>f[i];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
        for(int j=1;j<=n;j++){
            if(b[i]==f[j]){
                a[i]=j;
                tex[i]++;
            }
        }
        if(a[i]==0) {cout<<"Impossible"; return 0;}
        else if(tex[i]>1) c++;
    }

    if(c==m) {cout<<"Ambiguity"; return 0;}

    cout<<"Possible"<<endl;
    for(int i=1;i<=m;i++) cout<<a[i]<<" ";

    return 0;
}


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

int n,m,u=1,C;
int main()
{
    cin>>n>>m;
    vector<int> a(m),f(n),b(m),tex(m);
    for(int i=1;i<=n;i++){
        cin>>f[i];
    }
    for(int i=1;i<=m;i++) cin>>b[i];

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(b[i]==f[j]){
                a[i]=j;
                tex[i]++;
            }
        }
    }

    for(int i=1;i<=m;i++){
        if(tex[i]>1)
            C++;
    }
    if(C==m) {cout<<"Ambiguity"; return 0;}

    for(int i=1;i<=m;i++){
        if(a[i]==0){cout<<"Impossible"; return 0;}
    }

    cout<<"Possible"<<endl;
    for(int i=1;i<=m;i++) cout<<a[i]<<" ";

    return 0;
}


#include<iostream>
#include<vector>
#include<cstdio>

using namespace std;

int n,m,c,u;
int a[100021],f[100021],b[100021];
int main()
{
    cin>>n>>m;
    vector<int> c[n];

    for(int i=1;i<=n;i++) { cin>>f[i]; f[i]--; c[f[i]].push_back(i); }
    for(int i=1;i<=m;i++) { cin>>b[i]; b[i]--; }

    for (int i=1;i<=m;i++) {
        if (c[b[i]].size()==0) { cout<<"Impossible"; return 0; }
        if (c[b[i]].size()>1) { u=1; }

        a[i]=c[b[i]];
    }
    if(u==1){ cout<<"Ambiguity"; return 0; }
    else {
        cout<<"Possible"<<endl;
    for (int i=1;i<=m;i++)
        cout<<a[i]<<" ";
    }
    return 0;
}


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

int n,m,u=1,C,k;
int a[100001],f[100001],b[100001],tex[100001];
int main()
{
    cin>>n>>m;
    //vector<int> a(m),f(n),b(m),tex(m);
    for(int i=1;i<=n;i++){
        cin>>f[i];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
        for(int j=1;j<=n;j++){
            if(b[i]==f[j]){
                a[i]=j;
                C++;
            }
        }
        if(C>1) k=1;
        else k=0;

        C=0;
    }
    if(k) {cout<<"Ambiguity"; return 0;}

    for(int i=1;i<=m;i++){
        if(a[i]==0){cout<<"Impossible"; return 0;}
    }

    cout<<"Possible"<<endl;
    for(int i=1;i<=m;i++) cout<<a[i]<<" ";

    return 0;
}


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

int n,m,u=1,C,k;
int a[100001],f[100001],b[100001],tex[100001];
int main()
{
    cin>>n>>m;
    //vector<int> a(m),f(n),b(m),tex(m);
    for(int i=1;i<=n;i++){
        cin>>f[i];
    }
    for(int i=1;i<=m;i++) cin>>b[i];

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(b[i]==f[j]){
                a[i]=j;
                C++;
            }
        }
        if(C>1) k=1;
        else k=0;

        C=0;
    }

    if(k) {cout<<"Ambiguity"; return 0;}

    for(int i=1;i<=m;i++){
        if(a[i]==0){cout<<"Impossible"; return 0;}
    }

    cout<<"Possible"<<endl;
    for(int i=1;i<=m;i++) cout<<a[i]<<" ";

    return 0;
}


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

int n,m,u=1,C;
int a[100001],f[100001],b[100001],tex[100001];
int main()
{
    cin>>n>>m;
    //vector<int> a(m),f(n),b(m),tex(m);
    for(int i=1;i<=n;i++){
        cin>>f[i];
    }
    for(int i=1;i<=m;i++) cin>>b[i];

    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(b[i]==f[j]){
                a[i]=j;
                tex[i]++;
            }
        }
    }

    for(int i=1;i<=m;i++){
        if(tex[i]>1)
            C++;
    }
    if(C==m) {cout<<"Ambiguity"; return 0;}

    for(int i=1;i<=m;i++){
        if(a[i]==0){cout<<"Impossible"; return 0;}
    }

    cout<<"Possible"<<endl;
    for(int i=1;i<=m;i++) cout<<a[i]<<" ";

    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		flag = false;
		bool used[1000005];
		memset(used, 0, sizeof(used));

		rep(i, ans.size()) {
			if(used[f[ans[i]]-1]) {
				flag = true;
			} else {
				used[f[ans[i]]-1] = true;
			}
		}

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		flag = false;
		bool used[1000005];
		memset(used, 0, sizeof(used));

		rep(i, ans.size()) {
			if(used[b[ans[i]]-1]) {
				flag = true;
			} else {
				used[b[ans[i]]-1] = true;
			}
		}

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		flag = false;
		bool used[100005];
		memset(used, 0, sizeof(used));

		rep(i, ans.size()) {
			if(used[f[ans[i]]]) {
				flag = true;
			} else {
				used[f[ans[i]]] = true;
			}
		}

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		flag = false;
		bool used[1000005];
		memset(used, 0, sizeof(used));

		rep(i, ans.size()) {
			if(used[b[ans[i]]]) {
				flag = true;
			} else {
				used[b[ans[i]]] = true;
			}
		}

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		flag = false;
		set<int> st;
		rep(i, ans.size()) {
			if(st.find(f[ans[i]-1]) != st.end()) {
				flag = true;
			} else {
				st.insert( f[ans[i]-1]);
			}
		}

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		flag = false;
		bool used[100005];
		memset(used, 0, sizeof(used));

		rep(i, n) {
			if(used[f[i]]) {
				flag = true;
				break;
			} else {
				used[f[i]] = true;
			}
		}

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = false;
	bool ch = true;
	vector<int> ans;

	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);

			if(v[b[i]].size() >= 2) {
				flag = true;
			}
		} else {
			ch = false;
		}
	}

	if(ch) {

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = true;
	REP(i, 1, m) {
		if(b[0] == b[i]) continue;
		flag = false;
	}

	bool ch = true;
	vector<int> ans;
	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			v[b[i]].pop_back();
			ans.push_back(d);
		} else {
			ch = false;
		}
	}

	if(ch) {
		flag = false;
		bool used[100005];
		memset(used, 0, sizeof(used));

		rep(i, m) {
			if(used[b[i]]) {
				flag = true;
				break;
			} else {
				used[b[i]] = true;
			}
		}

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	vector<int> f(n), b(m);
	vector<vector<int > > v(100005);
	rep(i, n) {
		cin >> f[i];
		v[f[i]].push_back(i+1);
	}

	rep(i, m) {
		cin >> b[i];
	}

	bool flag = false;
	bool ch = true;
	vector<int> ans;

	rep(i, m) {
		if(v[b[i]].size() > 0) {
			int d = v[b[i]].back();
			ans.push_back(d);

			if(v[b[i]].size() >= 2) {
				flag = true;
			}
		} else {
			ch = false;
		}
	}

	if(ch) {

		if(flag) cout << "Ambiguity" << endl;
		else {
			cout << "Possible" << endl;
			rep(i, m) {
				cout << ans[i];
				if(i == m-1) cout << endl;
				else cout << " ";
			}
		}
	} else cout << "Impossible" << endl;

	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2){
			cout<<"Ambiguity"<<endl;
			return 0;
		}
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<b;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2){
			d=1;
		}
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
	         }
	}
if(d){
cout<<"Ambiguity"<<endl;
return 0;
}
	cout<<"Possible"<<endl;
	for(int i=0;i<b;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2)
			d=1;
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
		//vis[rr[i]]--;
	}
	if(d){
		cout<<"Ambiguity"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<a;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN];
vector<int>adj[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		if(vis[x])
			d=1;
		vis[x]++;
		adj[x].pb(i+1);
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
		vis[rr[i]]--;
	}
	if(d){
		cout<<"Ambiguity"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<a;i++){
		cout<<adj[rr[i]][adj[rr[i]].size()-1]<<" ";
		adj[rr[i]].ppb();
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2){
			cout<<"Ambiguity"<<endl;
			return 0;
		}
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
		vis[rr[i]]=0;
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<a;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2){
			d=1;
		}
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
		vis[rr[i]]=0;
	}
	if(d){
		cout<<"Ambiguity"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<a;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		if(vis[x])
			d=1;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
		vis[rr[i]]--;
	}
	if(d){
		cout<<"Ambiguity"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<a;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2){
			cout<<"Ambiguity"<<endl;
			return 0;
		}
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<a;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2)
			d=1;
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
		vis[rr[i]]--;
	}
	if(d){
		cout<<"Ambiguity"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<b;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


//#include<bits/stdc++.h>
//#include <fstream>
#include<iostream>
#include<cmath>
#include<time.h>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#define P_ M_PI
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define ff first
#define cs(x,y) cout<<"Case "<<y<<": "<<x<<endl;
#define ss second
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define rand srand( (unsigned)time( NULL ) ); int randomNumber = rand()%1001 + 1;
using namespace std;
/*
ifstream cin("file.in");
ofstream cout("file.out");
*/

int n,m,arr[MAXN],rr[MAXN],a[MAXN];
vector<int>v;
int main()
{
	cin>>n>>m;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	for(int j=1;j<=m;j++)
	{
		cin>>rr[j];
	}

	for(int i=1;i<=n;i++)
	{
		if(rr[arr[i]]==arr[i])
		{
			v.push_back(arr[i]);
			a[arr[i]]++;
		}
	}

	sort(a+1,a+1+n);
	reverse(a+1,a+1+n);
	bool b=0;

	if(v.size()==0)
	{
		cout<<"Impossible";
		return 0;
	}

	else
	{
		for(int i=1;i<=n;i++)
		{
			if(a[i]>1)
			{
				cout<<"Ambiguity";
				return 0;
			}

		}
		cout<<"Possible"<<endl;

		for(int i=0;i<v.size();i++)
		{
			cout<<v[i]<<" ";
		}
	}

return 0;
}


#include<bits/stdc++.h>
#define MAXN 100009
#define INF 1000000007
#define LLINF 1000000000000000007
#define mp(x,y) make_pair(x,y)
#define wr cout<<"You can do IT.I belive YOU!!!"<<endl;
#define ff first
#define ss second
#define lg(x) ceil(log2(x))
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define ppb() pop_back()
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
//#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>asd;
typedef long long ll;
typedef pair<int,int> PII;
template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
int vis[MAXN],rr[MAXN],h[MAXN];
//asd s;
int main(){
	int a,b,x,d=0;
	cin>>a>>b;
	for(int i=0;i<a;i++){
		cin>>x;
		vis[x]++;
		h[x]=i+1;
	}
	for(int i=0;i<b;i++){
		cin>>rr[i];
		if(vis[rr[i]]>=2)
			d=1;
		if(!vis[rr[i]]){
			cout<<"Impossible"<<endl;
			return 0;
		}
		vis[rr[i]]--;
	}
	if(d){
		cout<<"Ambiguity"<<endl;
		return 0;
	}
	cout<<"Possible"<<endl;
	for(int i=0;i<a;i++){
		cout<<h[rr[i]]<<" ";
	}
	return 0;
}


//IN THE NAME OF ALLAH
#include <iostream>
#include <vector>
#include <map>

using namespace std;

const int N = 1000 * 100 + 33;
int ary[N];
map <int, int> place , megh;
int b[N], f[N];
bool mul;

int main(){
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> f[i];
		f[i];
		megh[f[i]] ++;
		place[f[i]] = i;
	}
	for(int i = 0; i < m; i++){
		cin >> b[i];
		if(megh[b[i]] > 1)
			mul = true;
		if(!mul && megh[b[i]] == 1)
			ary[i] = place[b[i]];
		megh[b[i]] --;
		if(megh[b[i]] < 0){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	if(mul){
		cout << "Ambiguity" << endl;
		return 0;
	}
	cout << "Possible" << endl;
	for(int i = 0; i < m; i++){
		cout << ary[i] + 1 << " ";
	}
	cout << endl;
	return 0;
}


//IN THE NAME OF ALLAH
#include <iostream>
#include <map>
#include <vector>

using namespace std;

const int N = 1000 * 100 + 23;
map <int, int> megh, place;
int ary[N];
vector <int> vec;

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

	for(int i = 0; i< n; i++){
		int a;
		cin >> a;
		a--;
		megh[a] ++;
		place[a] = i;
	}

	bool mul = 0;
	for(int i = 0; i < m; i++){
		int a;
		cin >> a;
		a--;
		if(megh[a] > 1)
			mul = true;
		else if(megh[a] == 1){
			ary[a] = place[a];
		}
		megh[a] --;
		if(megh[a] < 0){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	if(mul){
		cout << "Ambiguity" << endl;
		return 0;
	}
	cout << "Possible"  << endl;
	for(int i = 0; i < m; i++){
		cout << ary[i] + 1<< " ";
	}
	cout << endl;
	return 0;
}


//IN THE NAME OF ALLAH
#include <iostream>
#include <map>
#include <vector>

using namespace std;

const int N = 1000 * 100 + 23;
map <int, int> megh, place;
int ary[N];
vector <int> vec;

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

	for(int i = 0; i< m; i++){
		int a;
		cin >> a;
		a--;
		megh[a] ++;
		place[a] = i;
	}
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		a--;
		vec.push_back(a);
	}
	bool mul = 0;
	for(int i = 0; i < m; i++){
		int a = vec[i];
		if(megh[a] > 1)
			mul = true;
		else if(megh[a] == 1){
			ary[place[a]] = a;
		}
		megh[a] --;
		if(megh[a] < 0){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	if(mul){
		cout << "Ambiguity" << endl;
		return 0;
	}
	cout << "Possible"  << endl;
	for(int i = 0; i < m; i++){
		cout << ary[i] + 1<< " ";
	}
	cout << endl;
	return 0;
}


//IN THE NAME OF ALLAH
#include <iostream>
#include <vector>
#include <map>

using namespace std;

const int N = 1000 * 100 + 33;
int ary[N];
map <int, int> place , megh;
int b[N], f[N];
bool mul;

int main(){
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> f[i];
		f[i];
		megh[f[i]] ++;
		place[f[i]] = i;
	}
	for(int i = 0; i < m; i++){
		cin >> b[i];
		if(megh[b[i]] > 1)
			mul = true;
		if(!mul && megh[b[i]] == 1)
			ary[i] = place[b[i]];
		if(megh[b[i]] == 0){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	if(mul){
		cout << "Ambiguity" << endl;
		return 0;
	}
	cout << "Possible" << endl;
	for(int i = 0; i < m; i++){
		cout << ary[i] + 1 << " ";
	}
	cout << endl;
	return 0;
}


//IN THE NAME OF ALLAH
#include <iostream>
#include <map>
#include <vector>

using namespace std;

const int N = 1000 * 100 + 23;
map <int, int> megh, place;
int ary[N];
vector <int> vec;

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

	for(int i = 0; i< n; i++){
		int a;
		cin >> a;
		a--;
		megh[a] ++;
		place[a] = i;
	}

	bool mul = 0;
	for(int i = 0; i < m; i++){
		int a;
		cin >> a;
		a--;
		if(megh[a] > 1)
			mul = true;
		else if(megh[a] == 1){
			ary[place[a]] = a;
		}
		megh[a] --;
		if(megh[a] < 0){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	if(mul){
		cout << "Ambiguity" << endl;
		return 0;
	}
	cout << "Possible"  << endl;
	for(int i = 0; i < m; i++){
		cout << ary[i] + 1<< " ";
	}
	cout << endl;
	return 0;
}


//IN THE NAME OF ALLAH
#include <iostream>
#include <map>
#include <vector>

using namespace std;

const int N = 1000 * 100 + 23;
map <int, int> megh, place;
int ary[N];
vector <int> vec;

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

	for(int i = 0; i< n; i++){
		int a;
		cin >> a;
		a--;
		megh[a] ++;
		place[a] = i;
	}

	bool mul = 0;
	for(int i = 0; i < m; i++){
		int a;
		cin >> a;
		a--;
		if(megh[a] > 1)
			mul = true;
		else if(megh[a] == 1){
			ary[i] = place[a];
		}
		megh[a] --;
		if(megh[a] < 0){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	if(mul){
		cout << "Ambiguity" << endl;
		return 0;
	}
	cout << "Possible"  << endl;
	for(int i = 0; i < m; i++){
		cout << ary[i] + 1<< " ";
	}
	cout << endl;
	return 0;
}


//IN THE NAME OF ALLAH
#include <iostream>
#include <map>
#include <vector>

using namespace std;

const int N = 1000 * 100 + 23;
map <int, int> megh, place;
int ary[N];
vector <int> vec;

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

	for(int i = 0; i< n; i++){
		int a;
		cin >> a;
		a--;
		megh[a] ++;
		place[a] = i;
	}

	bool mul = 0;
	for(int i = 0; i < m; i++){
		int a;
		cin >> a;
		if(megh[a] > 1)
			mul = true;
		else if(megh[a] == 1){
			ary[place[a]] = a;
		}
		megh[a] --;
		if(megh[a] < 0){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	if(mul){
		cout << "Ambiguity" << endl;
		return 0;
	}
	cout << "Possible"  << endl;
	for(int i = 0; i < m; i++){
		cout << ary[i] + 1<< " ";
	}
	cout << endl;
	return 0;
}


#include <stdio.h>
#include <algorithm>
#define f first
#define s second

using namespace std;

int n, ans[100010], m;
pair <int, int> lis[100010], b[100010];

int main()
{
	scanf("%d%d", &m, &n);
	int i;
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		lis[i].f = a;
		lis[i].s = i;
	}
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		b[i].f = a;
		b[i].s = i;
	}
	sort(b, b + n);
	sort(lis, lis + n);
	int ff = 1;
	for(i = 0; i < n; i++)
	{
		if(i && lis[i].f == lis[i - 1].f)
			ff = 2;
		if(lis[i].f != b[i].f)
		{
			ff = 0;
			break;
		}
		ans[b[i].s] = lis[i].s + 1;
	}
	if(ff == 0)
		printf("Impossible\n");
	else if(ff == 2)
		printf("Ambiguity\n");
	else
	{
		printf("Possible\n");
		for(i = 0; i < n; i++)
			printf("%d%c", ans[i], (i == n - 1 ? '\n' : ' '));
	}
	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <string.h>
#define f first
#define s second

using namespace std;

int n, ans[100010], m, vis[100010];
pair <int, int> lis[100010], b[100010];

int main()
{
	memset(vis, 0, sizeof vis);
	scanf("%d%d", &n, &m);
	int i;
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		lis[i].f = a;
		lis[i].s = i;
	}
	for(i = 0; i < m; i++)
	{
		int a;
		scanf("%d", &a);
		b[i].f = a;
		b[i].s = i;
	}
	stable_sort(b, b + m);
	stable_sort(lis, lis + n);
	int ff = 1, cur = 0;
	for(i = 0; i < m && cur < n; i++)
	{
		while(lis[cur].f != b[i].f && cur < n)
			cur++;
		vis[b[i].f] = 1;
		ans[b[i].s] = lis[cur].s + 1;
	}
	for(int j = 1; j < n; j++)
		if(lis[j].f == lis[j - 1].f && vis[lis[j - 1].f])
			ff = 2;
	if(i != m)
		ff = 0;
	if(ff == 0)
		printf("Impossible\n");
	else if(ff == 2)
		printf("Ambiguity\n");
	else
	{
		printf("Possible\n");
		for(i = 0; i < m; i++)
			printf("%d%c", ans[i], (i == m - 1 ? '\n' : ' '));
	}
	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <string.h>
#define f first
#define s second

using namespace std;

int n, ans[100010], m, vis[100010];
pair <int, int> lis[100010], b[100010];

int main()
{
	memset(vis, 0, sizeof vis);
	scanf("%d%d", &n, &m);
	int i;
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		lis[i].f = a;
		lis[i].s = i;
	}
	for(i = 0; i < m; i++)
	{
		int a;
		scanf("%d", &a);
		b[i].f = a;
		b[i].s = i;
	}
	stable_sort(b, b + m);
	stable_sort(lis, lis + n);
	int ff = 1, cur = 0;
	for(i = 0; i < m && cur < n; i++)
	{
		while(lis[cur].f != b[i].f && cur < n)
			cur++;
		vis[b[i].f] = 1;
		ans[b[i].s] = lis[cur].s + 1;
	}
	for(i = 1; i < n; i++)
		if(lis[i].f == lis[i - 1].f && vis[lis[i - 1].f])
			ff = 2;
	if(i != m)
		ff = 0;
	if(ff == 0)
		printf("Impossible\n");
	else if(ff == 2)
		printf("Ambiguity\n");
	else
	{
		printf("Possible\n");
		for(i = 0; i < m; i++)
			printf("%d%c", ans[i], (i == m - 1 ? '\n' : ' '));
	}
	return 0;
}


#include <stdio.h>
#include <algorithm>
#define f first
#define s second

using namespace std;

int n, ans[100010], m;
pair <int, int> lis[100010], b[100010];

int main()
{
	scanf("%d%d", &n, &m);
	int i;
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		lis[i].f = a;
		lis[i].s = i;
	}
	for(i = 0; i < m; i++)
	{
		int a;
		scanf("%d", &a);
		b[i].f = a;
		b[i].s = i;
	}
	stable_sort(b, b + m);
	stable_sort(lis, lis + n);
	int ff = 1, cur = 0;
	for(i = 1; i < n; i++)
		if(lis[i].f == lis[i - 1].f)
			ff = 2;
	for(i = 0; i < m && cur < n; i++)
	{
		while(lis[cur].f != b[i].f && cur < n)
			cur++;
		ans[b[i].s] = lis[cur].s + 1;
	}
	if(i != m)
		ff = 0;
	if(ff == 0)
		printf("Impossible\n");
	else if(ff == 2)
		printf("Ambiguity\n");
	else
	{
		printf("Possible\n");
		for(i = 0; i < m; i++)
			printf("%d%c", ans[i], (i == m - 1 ? '\n' : ' '));
	}
	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <string.h>
#define f first
#define s second

using namespace std;

int n, ans[100010], m, vis[100010];
pair <int, int> lis[100010], b[100010];

int main()
{
	memset(vis, 0, sizeof vis);
	scanf("%d%d", &n, &m);
	int i;
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		lis[i].f = a;
		lis[i].s = i;
	}
	for(i = 0; i < m; i++)
	{
		int a;
		scanf("%d", &a);
		b[i].f = a;
		b[i].s = i;
	}
	stable_sort(b, b + m);
	stable_sort(lis, lis + n);
	int ff = 1, cur = 0;
	for(i = 0; i < m && cur < n; i++)
	{
		while(lis[cur].f != b[i].f && cur < n)
			cur++;
		if(cur == n)
		{
			ff = 0;
			break;
		}
		vis[b[i].f] = 1;
		ans[b[i].s] = lis[cur].s + 1;
	}
	for(int j = 1; j < n && ff; j++)
		if(lis[j].f == lis[j - 1].f && vis[lis[j - 1].f])
			ff = 2;
	if(i != m)
		ff = 0;
	if(ff == 0)
		printf("Impossible\n");
	else if(ff == 2)
		printf("Ambiguity\n");
	else
	{
		printf("Possible\n");
		for(i = 0; i < m; i++)
			printf("%d%c", ans[i], (i == m - 1 ? '\n' : ' '));
	}
	return 0;
}


#include <stdio.h>
#include <algorithm>
#define f first
#define s second

using namespace std;

int n, ans[100010], m;
pair <int, int> lis[100010], b[100010];

int main()
{
	scanf("%d%d", &n, &m);
	int i;
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		lis[i].f = a;
		lis[i].s = i;
	}
	for(i = 0; i < m; i++)
	{
		int a;
		scanf("%d", &a);
		b[i].f = a;
		b[i].s = i;
	}
	sort(b, b + n);
	sort(lis, lis + n);
	int ff = 1, cur = 0;
	for(i = 0; i < m && cur < n; i++)
	{
		if(i && b[i].f == b[i - 1].f)
			ff = 2;
		while(lis[cur].f != b[i].f && cur < n)
			cur++;
		ans[b[i].s] = lis[i].s + 1;
	}
	if(i != m)
		ff = 0;
	if(ff == 0)
		printf("Impossible\n");
	else if(ff == 2)
		printf("Ambiguity\n");
	else
	{
		printf("Possible\n");
		for(i = 0; i < n; i++)
			printf("%d%c", ans[i], (i == n - 1 ? '\n' : ' '));
	}
	return 0;
}


#include <stdio.h>
#include <algorithm>
#define f first
#define s second

using namespace std;

int n, ans[100010], m;
pair <int, int> lis[100010], b[100010];

int main()
{
	scanf("%d%d", &n, &m);
	int i;
	for(i = 0; i < n; i++)
	{
		int a;
		scanf("%d", &a);
		lis[i].f = a;
		lis[i].s = i;
	}
	for(i = 0; i < m; i++)
	{
		int a;
		scanf("%d", &a);
		b[i].f = a;
		b[i].s = i;
	}
	stable_sort(b, b + n);
	stable_sort(lis, lis + n);
	int ff = 1, cur = 0;
	for(i = 1; i < n; i++)
		if(lis[i].f == lis[i - 1].f)
			ff = 2;
	for(i = 0; i < m && cur < n; i++)
	{
		while(lis[cur].f != b[i].f && cur < n)
			cur++;
		ans[b[i].s] = lis[cur].s + 1;
	}
	if(i != m)
		ff = 0;
	if(ff == 0)
		printf("Impossible\n");
	else if(ff == 2)
		printf("Ambiguity\n");
	else
	{
		printf("Possible\n");
		for(i = 0; i < m; i++)
			printf("%d%c", ans[i], (i == m - 1 ? '\n' : ' '));
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    pair<int,int>f[n];
    map<int,int>res;
    for(int i=0;i<n;i++)
        cin>>f[i].first,f[i].second=i+1,f1[f[i].first]++,res[f[i].first]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    sort(b,b+m);
    sort(f,f+n);
    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
    {
        if(it->second<=f1[it->first] && it->second>1)
            return cout<<"Ambiguity\n",0;
        else if(f1[it->first]==0)
            return cout<<"Impossible\n",0;
    }
    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    //pair<int,int>f[n];
    map<int,int>res;
    int a;
    for(int i=0;i<n;i++)
        cin>>a,f1[a]++,res[a]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
        if(it->second<=f1[it->first] && (it->second>1||(f1[it->first]>1 && it->second==1)))
            return cout<<"Ambiguity\n",0;
        else if(f1[it->first]==0)
            return cout<<"Impossible\n",0;

    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    //pair<int,int>f[n];
    map<int,int>res;
    int a;
    for(int i=0;i<n;i++)
        cin>>a,f1[a]++,res[a]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    bool no=0,am=0;
    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
        if(it->second<=f1[it->first] && f1[it->first] > 1 )
            am=1;
        else if(f1[it->first]==0)
            no=1;

            if(no)
                 return cout<<"Impossible\n",0;
            if(am)
                return cout<<"Ambiguity\n",0;
    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    //pair<int,int>f[n];
    map<int,int>res;
    int a;
    for(int i=0;i<n;i++)
        cin>>a,f1[a]++,res[a]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
        if(it->second<f1[it->first] )
            return cout<<"Ambiguity\n",0;
        else if(f1[it->first]==0)
            return cout<<"Impossible\n",0;

    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    //pair<int,int>f[n];
    map<int,int>res;
    int a;
    for(int i=0;i<n;i++)
        cin>>a,f1[a]++,res[a]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
        if(it->second<=f1[it->first] && f1[it->first] > 1 )
            return cout<<"Ambiguity\n",0;
        else if(f1[it->first]==0)
            return cout<<"Impossible\n",0;

    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    pair<int,int>f[n];
    map<int,int>res;
    for(int i=0;i<n;i++)
        cin>>f[i].first,f[i].second=i+1,f1[f[i].first]++,res[f[i].first]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    sort(b,b+m);
    sort(f,f+n);
    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
    {
        if(it->second<=f1[it->first] && it->second>1)
            return cout<<"Ambiguity\n",0;
        else if(it->second>f1[it->first])
            return cout<<"Impossible\n",0;
    }
    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    //pair<int,int>f[n];
    map<int,int>res;
    int a;
    for(int i=0;i<n;i++)
        cin>>a,f1[a]++,res[a]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
        if(it->second==f1[it->first] )
            return cout<<"Ambiguity\n",0;
        else if(f1[it->first]==0)
            return cout<<"Impossible\n",0;

    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    int b[m];
    map<int,int>f1,b1;
    //pair<int,int>f[n];
    map<int,int>res;
    int a;
    for(int i=0;i<n;i++)
        cin>>a,f1[a]++,res[a]=i+1;

    for(int i=0;i<m;i++)
        cin>>b[i],b1[b[i]]++;

    for(map<int,int>::iterator it=b1.begin();it!=b1.end();it++)
        if(it->second==f1[it->first] && it->second>1)
            return cout<<"Ambiguity\n",0;
        else if(f1[it->first]==0)
            return cout<<"Impossible\n",0;

    cout<<"Possible\n";
     for(int i=0;i<m;i++)
     {
         cout<<res[b[i]]<<" ";
     }
    return 0;
}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
pair <int, int> a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int bin_s (int x) {
    int l = 1;
    int r = n;
    while (l <= r) {
        int mid = (l + r) / 2;
        if (a[mid].first > x)
            r = mid - 1;
        if (a[mid].first < x)
            l = mid + 1;
        if (a[mid].first == x)
            return a[mid].second;
    }
}

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i].first);
        a[i].second = i;
        san[a[i].first]++;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        san2[b[i]]++;
    }
    for (int i = 1; i <= 100001; i++) {
        if (san2[i] > san[i])
            imp = true;
        if (san2[i] == san[i] && san[i] > 1)
            amb = true;
    }
    if (imp)
        cout << "Impossible";
    else if(amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++) {
            cout << bin_s (b[i]) << " ";
        }
    }

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        if (!san[b[i]])
            imp = true;
        san2[b[i]]++;
    }
    for (int i = 1; i <= 100001; i++) {
        if (san2[i] == san[i] && san2[i] > 1)
            amb = true;
        else if (san2[i] > san[i])
            imp = true;

    }
    if (imp)
        cout << "Impossible";
    else if(amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++) {
            cout << f[b[i]] << " ";
        }
    }

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        if (!san[b[i]])
            imp = true;
        else if (san[b[i]] > 1)
            amb = true;
        else
            san[b[i]]--;
    }
    if (imp)
        cout << "Impossible",exit (0);
    if (amb)
        cout << "Ambiguity", ex;
    cout << "Possible\n";
    for (int i = 1; i <= m; i++)
        cout << f[b[i]] << " ";

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

int n, m,a[100001], b[100001], j,pos[100001];
bool was[100001];
bool amb;
int k;

int main (){

    srand (time (NULL));
//  files (fname);

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
    }
    for (int i = 1; i <= m; i++)
        scanf ("%d", &b[i]);
    sort (a + 1, a + 1 + n);
    sort (b + 1, b + 1 + m);
    for (int i = 1; i <= max (n, m); i++) {
        if (a[i] == b[++k]) {
            j = i;
            was[k] = true;
            pos[k] = i;
            while (a[j] == b[k] && j <= max (n, m))
                j++;
            if (j - i > 2)
                amb = true;
            i = j - 1;
        }
    }
    for (int i = 1; i <= m; i++)
        if (!was[i])
            if (a[m] == a[1])
                break;
            else
                cout << "Impossible",exit (0);
    if (amb)
        cout << "Ambiguity",ex;
    else
        cout << "Possible" << endl;
    for (int i = 1; i <= m; i++)
        cout << pos[i] << " ";
    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        san2[b[i]]++;
    }
    for (int i = 1; i <= 100001; i++) {
        if (san2[i] > san[i])
            imp = true;
        if (san2[i] > 1)
            amb = true;
    }
    if (imp)
        cout << "Impossible";
    else if(amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++) {
            cout << f[b[i]] << " ";
        }
    }

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        if (san[b[i]] > 1)
            amb = true;
        if (!san[b[i]])
            imp = true;
        else
            san[b[i]]--;
    }

    if (imp)
        cout << "Impossible",exit (0);
    if (amb)
        cout << "Ambiguity", ex;
    cout << "Possible\n";
    for (int i = 1; i <= m; i++)
        cout << f[b[i]] << " ";

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

int n, m,a[100001], b[100001], j,pos[100001];
bool was[100001];
bool amb;
int k;

int main (){

    srand (time (NULL));
    files (fname);

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
    }
    for (int i = 1; i <= m; i++)
        scanf ("%d", &b[i]);
    sort (a + 1, a + 1 + n);
    sort (b + 1, b + 1 + m);
    for (int i = 1; i <= max (n, m); i++) {
        if (a[i] == b[++k]) {
            j = i;
            was[k] = true;
            pos[k] = i;
            while (a[j] == b[k] && j <= max (n, m))
                j++;
            if (j - i > 2)
                amb = true;
            i = j - 1;
        }
    }
    for (int i = 1; i <= m; i++)
        if (!was[i])
            if (a[m] == a[1])
                break;
            else
                cout << "Impossible",exit (0);
    if (amb)
        cout << "Ambiguity",ex;
    else
        cout << "Possible" << endl;
    for (int i = 1; i <= m; i++)
        cout << pos[i] << " ";
    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        san2[b[i]]++;
    }
    for (int i = 1; i <= 100001; i++) {
        if (san2[i] > san[i])
            imp = true;
        if (san[i] > 1)
            amb = true;
    }
    if (imp)
        cout << "Impossible";
    else if(amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++) {
            cout << f[b[i]] << " ";
        }
    }

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

int n, m, pos[100001];
bool imp, amb;
int x;
pair <int, int> a[100001];
int san[100001], san2[100001];

int go_bins (int x) {
    int l = 1;
    int r = n;
    while (l <= r) {
        int mid = (l + r) / 2;
        if (a[mid].first > x)
            r = mid - 1;
        if (a[mid].first < x)
            l = mid + 1;
        if (a[mid].first == x){
            if (a[mid - 1].first == x || a[mid + 1].first == x)
                amb = true;
            return a[mid].second;
        }
    }
    imp = true;
}

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    a[0].first = a[n + 1].first = -1;
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i].first);
        a[i].second = i;
        san[a[i].first]++;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &x), pos[i] = go_bins(x);
        san2[x]++;
    }
    for (int i = 1; i <= n; i++)
        if (san2[i] > san[i])
            imp = true;
    if (imp)
        cout << "Impossible";
    else if (amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++)
            cout << pos[i] << " ";
    }

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        san2[b[i]]++;
    }
    for (int i = 1; i <= 100001; i++) {
        if (san2[i] > san[i])
            imp = true;
        if (san2[i] == san[i] && san[i] > 1)
            amb = true;
    }
    if (imp)
        cout << "Impossible";
    else if(amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++) {
            cout << f[b[i]] << " ";
        }
    }

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        if (!san[b[i]])
            cout << "Impossible", ex;
    }
    for (int i = 1; i <= m; i++)
        if (san[b[i]] > 1)
            cout << "Ambiguity", ex;
    cout << "Possible\n";
    for (int i = 1; i <= m; i++)
        cout << f[b[i]] << " ";

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        if (san[b[i]] == 0)
            imp = true;
        san2[b[i]]++;
    }
    for (int i = 1; i <= 100001; i++) {
        if (san2[i] > san[i])
            imp = true;
        if (san2[i] > 1)
            amb = true;
    }
    if (imp)
        cout << "Impossible";
    else if(amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++) {
            cout << f[b[i]] << " ";
        }
    }

    return 0;

}


//Made by Aimenov Altair
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cstdlib>

inline int Rand (){ return (rand () << 16) | rand ();}
#define fi first
#define se second
#define mp make_pair
#define sz(x) ( (int) (x).size ())
#define pb(x) push_back (x)
#define pf(x) push_front (x)
#define abs(x) ((x) < 0 ? -(x) : (x))
#define INF 2000000000
#define sqr(x) ( (x) * (x))
#define all(x) x.begin (), x.end ()
#define fname ""
#define files(x) freopen (x".in", "r", stdin); freopen (x".out", "w", stdout);
#define MOD 1000000007
#define y1 google
#define eps 1e-9
#define ex exit (0)

typedef long long ll;

using namespace std;

const int N = 100001;
int a[N];
int san[N], san2[N], b[N];
bool imp, amb;
int n, m;
int f[N];

int main (){

    srand (time (NULL));

    scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", &a[i]);
        san[a[i]]++;
        f[a[i]] = i;
    }
    sort (a + 1, a + 1 + n);
    for (int i = 1; i <= m; i++){
        scanf ("%d", &b[i]);
        if (!san[b[i]])
            imp = true;
        san2[i]++;
    }
    for (int i = 1; i <= 100001; i++) {
        if (san2[i] > san[i])
            imp = true;
        if (san2[i] > 1)
            amb = true;
    }
    if (imp)
        cout << "Impossible";
    else if(amb)
        cout << "Ambiguity";
    else {
        cout << "Possible\n";
        for (int i = 1; i <= m; i++) {
            cout << f[b[i]] << " ";
        }
    }

    return 0;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

struct query{
    int t, l, r;
} b[200020];

void solve(){
    int n, m, q, x;
    cin >> n >> q >> m;
    int a[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < q; i++) cin >> b[i].t >> b[i].l >> b[i].r, --b[i].l, --b[i].r;
    while(m--){
        cin >> x; --x;
        for(int i = q-1; i >= 0; --i) if(b[i].l <= x && x <= b[i].r){
            if(b[i].t == 1) x = (x == b[i].l ? b[i].r : x-1);
            else x = b[i].r - (x-b[i].l);
        }
        cout << a[x] << " ";
    }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

void solve(){
    ll n, m, q, x;
    cin >> n >> q >> m;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    while(q--){
        ll t, l, r;
        cin >> t >> l >> r;
        --l, --r;
        if(t == 1) {
            x = a[r];
            for(ll i = r; i > l; --i) a[i] = a[i-1];
            a[l] = x;
        } else {
            for(ll i = 0; i <= (r-l)/2; i++) swap(a[l+i], a[r-i]);
        }
        // for(ll i = 0; i < n; i++) cout << a[i] << " ";
        // cout << endl;
    }
    while(m--){
        cin >> x;
        --x;
        cout << a[x] << " ";
    }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

void solve(){
    ll n, m, q, x;
    cin >> n >> m >> q;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    while(m--){
        ll t, l, r;
        cin >> t >> l >> r;
        --l, --r;
        if(t == 1) {
            x = a[r];
            for(ll i = r; i > l; --i) a[i] = a[i-1];
            a[l] = x;
        } else {
            for(ll i = 0; i <= (r-l)/2; i++) swap(a[l+i], a[r-i]);
        }
        // for(ll i = 0; i < n; i++) cout << a[i] << " ";
        // cout << endl;
    }
    while(q--){
        cin >> x;
        --x;
        cout << a[x] << " ";
    }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

void solve(){
    ll n, m, q, x;
    cin >> n >> q >> m;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    while(m--){
        ll t, l, r;
        cin >> t >> l >> r;
        --l, --r;
        if(t == 1) {
            x = a[r];
            for(ll i = r; i > l; --i) a[i] = a[i-1];
            a[l] = x;
        } else {
            for(ll i = 0; i <= (r-l)/2; i++) swap(a[l+i], a[r-i]);
        }
        // for(ll i = 0; i < n; i++) cout << a[i] << " ";
        // cout << endl;
    }
    while(q--){
        cin >> x;
        --x;
        cout << a[x] << " ";
    }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

void solve(){
    int n, m, q, x;
    cin >> n >> q >> m;
    int a[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    while(q--){
        int t, l, r;
        cin >> t >> l >> r;
        --l, --r;
        if(t == 1) {
            x = a[r];
            for(int i = r; i > l; --i) a[i] = a[i-1];
            a[l] = x;
        } else {
            for(int i = 0; i <= (r-l)/2; i++) swap(a[l+i], a[r-i]);
        }
    }
    while(m--){
        cin >> x;
        --x;
        cout << a[x] << " ";
    }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, q, m;
  std::cin >> n >> q >> m;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  struct Query { int ty, l, r; };
  std::vector<Query> queries(q);
  for (auto& query : queries) {
    std::cin >> query.ty >> query.l >> query.r;
    query.l--;
  }
  std::vector<int> b(m);
  for (int& x : b) {
    std::cin >> x;
    --x;
  }
  // for (int x : b) {
  //   for (int qi = q - 1; qi >= 0; --qi) {
  //     auto t = queries[qi];
  //     if (t.l <= x && x <= t.r) {
  //       if (t.ty == 1) {
  //         x = x == t.l ? t.r - 1 : x - 1;
  //       } else {
  //         x = t.r - 1 - x + t.l;
  //       }
  //     }
  //   }
  //   std::cout << a[x] << ' ';
  // }

    for (int i : b) {
      for (int qi = q - 1; qi >= 0; -- qi) {
        const auto &t = queries[qi];
        if (t.l <= i && i < t.r) {
          if (t.ty == 1) {
            i = i == t.l ? t.r - 1 : i - 1;
          } else {
            i = t.r - 1 - i + t.l;
          }
        }
      }
      std::cout << a[i] << ' ';
    }
  std::cout << "\n";
  std::cout.flush();
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, q, m;
  std::cin >> n >> q >> m;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  struct Query { int ty, l, r; };
  std::vector<Query> queries(q);
  for (auto& query : queries) {
    std::cin >> query.ty >> query.l >> query.r;
    query.l--;
  }
  std::vector<int> b(m);
  for (int& x : b) {
    std::cin >> x;
    --x;
  }
  for (int x : b) {
    for (int qi = q - 1; qi >= 0; --qi) {
      auto t = queries[qi];
      if (t.l <= x && x <= t.r) {
        if (t.ty == 1) {
          x = x == t.l ? t.r - 1 : x - 1;
        } else {
          x = t.r - 1 - x + t.l;
        }
      }
    }
    std::cout << a[x] << ' ';
  }
  std::cout << "\n";
  std::cout.flush();
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

int reverse(int x, int l, int r) {
  return r - 1 - (x - l);
}

int shift(int x, int l, int r) {
  return (x == l) ? (r - 1) : (x - 1);
}

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, q, m;
  std::cin >> n >> q >> m;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  struct Query { int ty, l, r; };
  std::vector<Query> queries(q);
  for (auto& query : queries) {
    std::cin >> query.ty >> query.l >> query.r;
    query.l--;
  }
  std::vector<int> b(m);
  for (int& x : b) {
    std::cin >> x;
    --x;
  }
  for (int x : b) {
    for (int qi = q - 1; qi >= 0; --qi) {
      auto t = queries[qi];
      if (t.l <= x && x <= t.r) {
        if (t.ty == 1) {
          x = shift(x, t.l, t.r); //x == t.l ? t.r - 1 : x - 1;
        } else {
          x = reverse(x, t.l, t.r); //t.r - 1 - x + t.l;
        }
      }
    }
    std::cout << a[x] << ' ';
  }
  std::cout << "\n";
  std::cout.flush();
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, q, m;
  std::cin >> n >> q >> m;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  struct Query { int ty, l, r; };
  std::vector<Query> queries(q);
  for (auto& query : queries) {
    std::cin >> query.ty >> query.l >> query.r;
    query.l--;
  }
  std::vector<int> b(m);
  for (int& x : b) {
    std::cin >> x;
    --x;
  }
  for (int qi = q - 1; qi >= 0; --qi) {
    auto t = queries[qi];
    for (int& x : b) {
      if (t.l <= x && x < t.r) {
        if (t.ty == 1) {
          x = x == t.l ? t.r - 1 : x - 1;
        } else {
          x = t.r - 1 - x + t.l;
        }
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    std::cout << a[b[i]] << ' ';
  }

  std::cout << "\n";
  std::cout.flush();
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n, q, m;
  std::cin >> n >> q >> m;
  std::vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  struct Query { int ty, l, r; };
  std::vector<Query> queries(q);
  for (auto& query : queries) {
    std::cin >> query.ty >> query.l >> query.r;
    query.l--;
  }
  std::vector<int> b(m);
  for (int& x : b) {
    std::cin >> x;
    --x;
  }
  for (int x : b) {
    for (int qi = q - 1; qi >= 0; --qi) {
      auto t = queries[qi];
      if (t.l <= x && x < t.r) {
        if (t.ty == 1) {
          x = x == t.l ? t.r - 1 : x - 1;
        } else {
          x = t.r - 1 - x + t.l;
        }
      }
    }
    std::cout << a[x] << ' ';
  }

  std::cout << "\n";
  std::cout.flush();
  return 0;
}


//Catchharsh
//Legendary Sage Jiraiya Sensei
#include<bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define F first
#define S second
#define sz(x) (ll)x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define debug(x) cout<<#x<<" = "<<x<<endl
#define catchharsh cout<<"\n---------catchharsh---------\n"
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//inline ll add(ll a,ll b){a+=b;if(a>=MOD)a-=MOD;return a;}
//inline ll sub(ll a,ll b){a-=b;if(a<0)a+=MOD;return a;}
//inline ll mul(ll a,ll b){return (a*1ll*b)%MOD;}
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{
     IOS;

     ll n,q,m,i,j,k;
     cin>>n>>q>>m;
     vector<ll>v(n+1);
     vector< pair<ll, pair<ll,ll> > > queries(q);
     for(i=1;i<=n;i++) cin>>v[i];
     for(i=0;i<q;i++)
        cin>>queries[i].F>>queries[i].S.F>>queries[i].S.S;
     reverse(all(queries));
     vector<ll> finals(m);
     for(i=0;i<m;i++)
     {
        cin>>finals[i];
     }
     for(i=0;i<q;i++)
     {
        for(j=0;j<m;j++)
        {
            ll idx=finals[j];
            int type=queries[i].F;
            ll l=queries[i].S.F;
            ll r=queries[i].S.S;
            if(idx<l || idx>r) continue;
            if(type==1)
            {
                idx--;
                if(idx==0) idx=r;
            }
            else
            {
                idx=r-(idx-l);
            }
            finals[j]=idx;
        }
     }
     for(i=0;i<m;i++)
        cout<<v[finals[i]]<<" ";

     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}


//Catchharsh
//Legendary Sage Jiraiya Sensei
#include<bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define F first
#define S second
#define sz(x) (ll)x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define debug(x) cout<<#x<<" = "<<x<<endl
#define catchharsh cout<<"\n---------catchharsh---------\n"
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//inline ll add(ll a,ll b){a+=b;if(a>=MOD)a-=MOD;return a;}
//inline ll sub(ll a,ll b){a-=b;if(a<0)a+=MOD;return a;}
//inline ll mul(ll a,ll b){return (a*1ll*b)%MOD;}
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{
     IOS;

     ll n,q,m,i,j,k;
     cin>>n>>q>>m;
     vector<ll>v(n+1);
     vector< pair<ll, pair<ll,ll> > > queries(q);
     for(i=1;i<=n;i++) cin>>v[i];
     for(i=0;i<q;i++)
        cin>>queries[i].F>>queries[i].S.F>>queries[i].S.S;
     reverse(all(queries));
     vector<ll> finals(m);
     for(i=0;i<m;i++)
     {
        cin>>finals[i];
     }
     for(i=0;i<q;i++)
     {
        for(j=0;j<m;j++)
        {
            ll idx=finals[j];
            int type=queries[i].F;
            ll l=queries[i].S.F;
            ll r=queries[i].S.S;
            if(idx<l || idx>r) continue;
            if(type==1)
            {
                idx--;
                if(idx==0) idx=n;
            }
            else
            {
                idx=r-(idx-l);
            }
            finals[j]=idx;
        }
     }
     for(i=0;i<m;i++)
        cout<<v[finals[i]]<<" ";

     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}


//Catchharsh
//Legendary Sage Jiraiya Sensei
#include<bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define F first
#define S second
#define sz(x) (ll)x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define debug(x) cout<<#x<<" = "<<x<<endl
#define catchharsh cout<<"\n---------catchharsh---------\n"
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//inline ll add(ll a,ll b){a+=b;if(a>=MOD)a-=MOD;return a;}
//inline ll sub(ll a,ll b){a-=b;if(a<0)a+=MOD;return a;}
//inline ll mul(ll a,ll b){return (a*1ll*b)%MOD;}
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}

int32_t main()
{
     IOS;

     ll n,q,m,i,j,k;
     cin>>n>>q>>m;
     vector<ll>v(n+1);
     vector< pair<ll, pair<ll,ll> > > queries(q);
     for(i=1;i<=n;i++) cin>>v[i];
     for(i=0;i<q;i++)
        cin>>queries[i].F>>queries[i].S.F>>queries[i].S.S;
     reverse(all(queries));
     vector<ll> finals(m);
     for(i=0;i<m;i++)
     {
        cin>>finals[i];
     }
     for(i=0;i<q;i++)
     {
        for(j=0;j<m;j++)
        {
            ll idx=finals[j];
            int type=queries[i].F;
            ll l=queries[i].S.F;
            ll r=queries[i].S.S;
            if(idx<l || idx>r) continue;
            if(type==1)
            {
                idx--;
                if(idx<l) idx=r;
            }
            else
            {
                idx=r-(idx-l);
            }
            finals[j]=idx;
        }
     }
     for(i=0;i<m;i++)
        cout<<v[finals[i]]<<" ";

     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}


#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const ll N = (ll) 1e6 + 7;
const int MOD = (int) 1e9 + 9;

int n, k, m, a[N], x, q[N], l[N], r[N], ans[N];
int main()
{
    cin >> n >> k >> m;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    for(int i = 1; i <= k; i++)
    {
        cin >> q[i] >> l[i] >> r[i];
    }
    for(int i = 1; i <= m; i++)
    {
        cin >> ans[i];
    }
    for(int i = 1; i <= k; i++)
    {
        if(q[i] == 1)
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    if(ans[j] == r[i])
                        ans[j] = l[i];
                    else
                        ans[j]++;
                }
            }
        }
        else
        {
            for(int j = 1; j <= m; j++)
            {
                if(ans[j] >= l[i] && ans[j] <= r[i])
                {
                    x = ans[j] - l[i] + 1;
                    x = (r[i] - l[i] + 1) - x + 1;
                    ans[j] = l[i] + x - 1;
                }
            }
        }
    }
    for(int i = 1; i <= m; i++)
    {
        cout << ans[i] << ' ';
    }
    return 0;
}