#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long int ll;
ll myfun(ll x, ll y)
{
    // for this example we have taken product
    // of adjacent numbers
    return x * y ;
}
int main()
{
	ll n,mini=10000001,maxi=-10000001,mpos=0,mneg=0,pos=0,neg=0,z=0,f=0;
	cin>>n;
	std::vector<ll> a(n);
	for (ll i = 0; i < n; ++i)
	{
		cin>>a[i];
		if(a[i]>0){
			if(a[i]<mini)mini=a[i];
			pos++;
		}
		else if(a[i]==0 || a[i]==-1){
			 z++;
		}
		else{
			if(a[i]>maxi)maxi=a[i];
			neg++;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		if(a[i]==maxi)mneg++;
		else if(a[i]==mini)mpos++;
	}
	if(pos==0 && neg==0 )
		{
			if(z%2==1)
			{
				cout<<0<<" ";
				for(ll i=0;i<n-1;++i)
					cout<<"-1 ";
			}
			else for(ll i=0;i<n;++i)cout<<"-1 ";

		}
	else
	{
		ll f=0,g=0,ppos,pneg,pneu,sum=1;
		std::vector<ll> vpos(n);
		std::vector<ll> vneg(n);
		std::vector<ll> vneu(n);
		for (ll i = 0; i < n; ++i)
		{
			if(a[i]>=0 &&(a[i]!=mini ||f==1))
				vpos[i]=(-1)*a[i]-1;
			else
				vpos[i]=a[i];
			if(a[i]==mini)
				f=1;

		}
		for (ll i = 0; i < n; ++i)
		{
			if(a[i]>=0)
				vneu[i]=(-1)*a[i]-1;
			else
				vneu[i]=a[i];

		}
		for (ll i = 0; i < n; ++i)
		{
			if(a[i]>=0 &&(a[i]!=maxi || g==1))
				vneg[i]=(-1)*a[i]-1;
			else
				vneg[i]=a[i];
			if(a[i]==maxi)
				g=1;

		}
		if((pos+neg+z)%2==0)
			for(ll i=0;i<n;++i)cout<<vneu[i]<<" ";
		else
		{
			if(((-1)*maxi-1)*mini>maxi*((-1)*mini-1))
				for(ll i=0;i<n;++i)cout<<vneg[i]<<" ";
			else if(((-1)*maxi-1)*mini<((-1)*maxi)*(mini+1))
				for(ll i=0;i<n;++i)cout<<vpos[i]<<" ";
			else if(mpos<mneg)
				for(ll i=0;i<n;++i)cout<<vneg[i]<<" ";
			else
				for(ll i=0;i<n;++i)cout<<vpos[i]<<" ";

		}
	}

}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,c,ct=0,ind_=-1,maxx_=1000000000,d;
        float maxx=-1000000000;
        float p;
        for(int i=0; i<n; i++)
        {
            if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }
            d=-1*c-1;
            ct++;
            //cout<<c<<" "<<d<<endl;
            p=(-1.0*c)/d;
            //cout<<p<<endl;
            if(p>maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ct==0)
            a[0]=0;
        else
           a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,c,ct=0,ind_=-1,maxx_=1000000000,d;
        float maxx=1000000;
        float p;
        for(int i=0; i<n; i++)
        {
            if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }

            d=-1*c-1;
            ct++;
            //cout<<c<<" "<<d<<endl;
            p=(-1.0*c)/d;
            //cout<<p<<endl;
            if(p<maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ct==0)
            a[0]=0;
        else
           a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,maxx=1000000000,c,ct=0;
        for(int i=0; i<n; i++)
        {
            if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }
            ct++;

            if(c<maxx)
            {
                maxx=c;
                ind=i;
            }
        }

        if(ct==0)
            a[0]=0;
        else
           a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,c,ct=0,d;
        float maxx=-1000000;
        float p;
        for(int i=0; i<n; i++)
        {
            /*if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;*/

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }

            d=-1*c-1;
            ct++;
            //cout<<c<<" "<<d<<endl;
            p=(-1.0*c)/d;
            //cout<<p<<endl;
            if(p>maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ind!=-1)
         a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,c,ct=0,d;
        double maxx=-1000000000,p;
        for(int i=0; i<n; i++)
        {
            /*if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;*/

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }

            d=-1*c-1;
            ct++;
            //cout<<c<<" "<<d<<endl;
            p=(-1.0*c)/d;
            //cout<<p<<endl;
            if(p>maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ind!=-1)
         a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<long long> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        long long ind=-1,c,ct=0,d;
        double maxx=-1000000000,p;
        for(int i=0; i<n; i++)
        {
            /*if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;*/

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }

            d=-1*c-1;
            ct++;
            //cout<<c<<" "<<d<<endl;
            p=(-1.0*c)/d;
            //cout<<p<<endl;
            if(p>maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ind!=-1)
         a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,c,ct=0,ind_=-1,maxx_=1000000000,d;
        float maxx=-1000000000;
        float p;
        for(int i=0; i<n; i++)
        {
            if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
                d=a[i];
            }
            ct++;

            p=(-1.0*c)/d;

            if(p>maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ct==0)
            a[0]=0;
        else
           a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,c,ct=0,ind_=-1,maxx_=1000000000,d;
        float maxx=-1000000;
        float p;
        for(int i=0; i<n; i++)
        {
            if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }

            d=-1*c-1;
            ct++;
            //cout<<c<<" "<<d<<endl;
            p=(-1.0*c)/d;
            //cout<<p<<endl;
            if(p>maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ct==0)
            a[0]=0;
        else
           a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


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

int main() {

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
     cin>>n;

    vector<int> a(n,0);

    for(int i=0; i<n; i++)
     cin>>a[i];

    if(n%2==0)
    {
        for(int i=0; i<n; i++)
        {
            if(a[i]>=0)
             a[i]=-1*a[i]-1;
        }
    }
    else
    {
        int ind=-1,c,ct=0,d;
        float maxx=-1000000000,p;
        for(int i=0; i<n; i++)
        {
            /*if(a[i]==0)
            {
             a[i]=-1;
             continue;
            }

            if(a[i]==-1)
             continue;*/

            if(a[i]<0)
                c=-1*a[i]-1;
            else
            {
                c=a[i];
                a[i]=-1*a[i]-1;
            }

            d=-1*c-1;
            ct++;
            //cout<<c<<" "<<d<<endl;
            p=(-1.0*c)/d;
            //cout<<p<<endl;
            if(p>maxx)
            {
                maxx=p;
                ind=i;
            }
        }

        if(ind!=-1)
         a[ind]=-1*a[ind]-1;

    }

	for(int i=0; i<n; i++)
	 cout<<a[i]<<" ";

	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;

    for(int i=0; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if(n%2==1){
        if(np==0){
            neg[0][0]=-neg[0][0]-1;
        }
        else{
            if(ng>0){ if(-neg[0][0]>pos[np-1][0]){ neg[0][0]=-neg[0][0]-1; } else pos[np-1][0]=-pos[np-1][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;

    for(int i=0; i<np-1; i++){ pos[i][0]=-pos[i][0]-1; }

    if((ng+np)%2==0){
        if(np>0) pos[0][0]=-pos[0][0]-1;
    }
    else{
        if(np==0){
            neg[0][0]=-neg[0][0]-1;
        }
        else{
            if(ng>0) if(-neg[0][0]>pos[0][0]){ neg[0][0]=-neg[0][0]-1; pos[np-1][0]=-pos[np-1][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;

    for(int i=1; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if((ng+np)%2==0){
        if(np>0) pos[0][0]=-pos[0][0]-1;
    }
    else{
        if(np==0){
            neg[0][0]=-neg[0][0]-1;
        }
        else{
            if(ng>0) if(-neg[0][0]>pos[0][0]){ neg[0][0]=-neg[0][0]-1; pos[0][0]=-pos[0][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;

    for(int i=0; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if(n%2==1){
        if(np==0){
            neg[0][0]=-neg[0][0]-1;
        }
        else{
            if(ng>0){ if(-neg[0][0]>pos[np-1][0]){ neg[0][0]=-neg[0][0]-1; } else pos[np-1][0]=-pos[np-1][0]-1; }
            else pos[np-1][0]=-pos[np-1][0]-1;
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;

    for(int i=0; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if(n%2==1){
        if(np==0){
            neg[0][0]=-neg[0][0]-1;
        }
        else{
            if(ng>0){ if(-neg[0][0]>-pos[np-1][0]){ neg[0][0]=-neg[0][0]-1; } else pos[np-1][0]=-pos[np-1][0]-1; }
            else pos[np-1][0]=-pos[np-1][0]-1;
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;

    for(int i=0; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if(n%2==1){
        if(np==0){
            neg[0][0]=-neg[0][0]-1;
        }
        else{
            if(ng>0) if(-neg[0][0]>pos[np-1[0]){ neg[0][0]=-neg[0][0]-1; } else pos[np-1][0]=-pos[np-1][0]-1;
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;
    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end());
    for(int i=1; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if((ng+np)%2==0){
        if(np>0) pos[0][0]=-pos[0][0]-1;
    }
    else{
        if(np==0){
            int i=0; for(; i<ng; i++) if(neg[i][0]==-1) break;
            if(i==0){ for(; i<ng; i++) neg[i][0]=0; }
            else{ neg[i-1][0]=-neg[i][0]-1; }
        }
        else{
            if(-neg[0][0]>pos[0][0]){ neg[0][0]=-neg[0][0]-1; pos[0][0]=-pos[0][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;
    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end());
    for(int i=1; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if((ng+np)%2==0){
        if(np>0) pos[0][0]=-pos[0][0]-1;
    }
    else{
        if(np==0){
            int i=0; for(; i<ng; i++) if(neg[i][0]==-1) break;
            if(i==0){ for(; i<ng; i++) neg[i][0]=0; }
            else{ neg[i-1][0]=-neg[i][0]-1; }
        }
        else{
            if(ng>0) if(-neg[0][0]>pos[0][0]){ neg[0][0]=-neg[0][0]-1; pos[0][0]=-pos[0][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;
    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    for(int i=1; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if((ng+np)%2==0){
        if(np>0) pos[0][0]=-pos[0][0]-1;
    }
    else{
        if(np==0){
            int i=0; for(; i<ng; i++) if(neg[i][0]==-1) break;
            if(i==0){ for(; i<ng; i++) neg[i][0]=0; }
            else{ neg[i-1][0]=-neg[i-1][0]-1; }
        }
        else{
            if(ng>0) if(-neg[0][0]>pos[0][0]){ neg[0][0]=-neg[0][0]-1; pos[0][0]=-pos[0][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end()); sort(neg.begin(),neg.end());
    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;

    for(int i=1; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if((ng+np)%2==0){
        if(np>0) pos[0][0]=-pos[0][0]-1;
    }
    else{
        if(np==0){
            int i=0; for(; i<ng; i++) if(neg[i][0]==-1) break;
            if(i==0){ for(; i<ng; i++) neg[i][0]=0; }
            else{ neg[i-1][0]=-neg[i-1][0]-1; }
        }
        else{
            if(ng>0) if(-neg[0][0]>pos[0][0]){ neg[0][0]=-neg[0][0]-1; pos[0][0]=-pos[0][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

//defines
typedef long long ll;

using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin>>n;

    vector<int> arr(n);
    vector<vector<int> > neg; int ng=0;
    vector<vector<int> > pos; int np=0;
    vector<int> temp(2);
    for(int i=0; i<n; i++){
        cin>>arr[i]; temp[1]=i;
        if(arr[i]<0){ temp[0]=arr[i]; neg.push_back(temp); ng++; }
        else if(arr[i]==0){ temp[0]=-1; neg.push_back(temp); ng++; }
        else { temp[0]=arr[i]; pos.push_back(temp); np++; }
    }

    //for(int i=0; i<ng; i++) cout<<neg[i][0]<<" "; cout<<endl;
    //for(int i=0; i<np; i++) cout<<pos[i][0]<<" "; cout<<endl;
    //for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;

    sort(pos.begin(),pos.end());
    for(int i=1; i<np; i++){ pos[i][0]=-pos[i][0]-1; }

    if((ng+np)%2==0){
        if(np>0) pos[0][0]=-pos[0][0]-1;
    }
    else{
        if(np==0){
            int i=0; for(; i<ng; i++) if(neg[i][0]==-1) break;
            if(i==0){ for(; i<ng; i++) neg[i][0]=0; }
            else{ neg[i-1][0]=-neg[i-1][0]-1; }
        }
        else{
            if(ng>0) if(-neg[0][0]>pos[0][0]){ neg[0][0]=-neg[0][0]-1; pos[0][0]=-pos[0][0]-1; }
        }
    }

    for(int i=0; i<ng; i++) arr[neg[i][1]]=neg[i][0];
    for(int i=0; i<np; i++) arr[pos[i][1]]=pos[i][0];

    for(int i=0; i<n; i++) cout<<arr[i]<<" "; cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	int ar[n];
	int x=-1;
	int k;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			{
				cnt++;
				ar[i]=(-arr[i]-1);
				if(arr[i]>x)
				{
					x=arr[i];
					k=i;
				}
			}
		else
			{
			 if(n==1)
			 ar[i]=(-arr[i]-1);
			 else
			 ar[i]=arr[i];
			}
	}
	if(n%2!=0 && cnt>0)
		ar[k]=(-ar[k]-1);
	for(int i=0;i<n;i++)
			cout << ar[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	int ar[n];
	int x=-1;
	int k;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			{
				cnt++;
				ar[i]=(-arr[i]-1);
				if(arr[i])
				{
					x=arr[i];
					k=i;
				}
			}
		else
			{
			 if(n==1)
			 ar[i]=(-arr[i]-1);
			 else
			 ar[i]=arr[i];
			}
	}
	if(cnt%2!=0 && cnt>0)
		ar[k]=(-ar[k]-1);
	for(int i=0;i<n;i++)
			cout << ar[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	int ar[n];
	int x=0;
	int k;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			{
				ar[i]=(-arr[i]-1);}

			if(arr[i]<x)
			{
					x=arr[i];
					k=i;
			}
	}
	if(n%2!=0)
		ar[k]=(-ar[k]-1);
	for(int i=0;i<n;i++)
			cout << ar[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	int ar[n];
	int x=0;
	int k;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			{
				ar[i]=(-arr[i]-1);}

			if(ar[i]<x)
			{
					x=ar[i];
					k=i;
		    }
		    if(arr[i]<0)
		    	ar[i]=arr[i];
	}
	if(n%2!=0)
		ar[k]=(-ar[k]-1);
	for(int i=0;i<n;i++)
			cout << ar[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	int ar[n];
	int x=0;
	int k;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			{
				ar[i]=(-arr[i]-1);}

			if(ar[i]<x)
			{
					x=ar[i];
					k=i;
		    }
	}
	if(n%2!=0)
		ar[k]=(-ar[k]-1);
	for(int i=0;i<n;i++)
			cout << ar[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	long long ans=1;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			cnt+=1;
	}
	if(n==1)
		{
			if(arr[0]<0)
		arr[0]=(-arr[0]-1);
		}
	else
		{
			sort(arr,arr+n,greater<int>());

			if(cnt%2!=0)
			cnt--;
			for(int i=0;i<cnt;i++)
			{
					if(arr[i]>=0)
						arr[i]=(-arr[i]-1);
			}

		}
			for(int i=0;i<n;i++)
			cout << arr[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	long long ans=1;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			cnt+=1;
	}
	if(n==1)
		ans=arr[n-1];
		sort(arr,arr+n);
		int x;
		if(cnt%2==0)
			x=n-1-cnt;
		else
			x=n-cnt;
		for(int i=n-1;i>(n-1-cnt);i--)
		{
			if(i>x)
			arr[i]=(-arr[i]-1);
		}
		for(int i=0;i<n;i++)
			cout << arr[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	int ar[n];
	int x=0;
	int k;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			{
				ar[i]=(-arr[i]-1);}

			if(arr[i]<x)
			{
					x=arr[i];
					k=i;
			}

	}
	if(n%2!=0)
		ar[k]=(-ar[k]-1);
	for(int i=0;i<n;i++)
			cout << ar[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	long long ans=1;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			cnt+=1;
	}
	if(n==1)
		if(arr[0]>=0)
		ans=arr[n-1];
		else
		ans=(-arr[0]-1);
	else
		{
			sort(arr,arr+n,greater<int>());

			if(cnt%2!=0)
			cnt--;
			for(int i=0;i<cnt;i++)
			{
					if(arr[i]>=0)
						arr[i]=(-arr[i]-1);
			}
		}
			for(int i=0;i<n;i++)
			cout << arr[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	long long ans=1;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			cnt+=1;
	}
	if(n==1)
		if(arr[0]>=0)
		arr[0]=arr[n-1];
		else
		arr[0]=(-arr[0]-1);
	else
		{
			sort(arr,arr+n,greater<int>());

			if(cnt%2!=0)
			cnt--;
			for(int i=0;i<cnt;i++)
			{
					if(arr[i]>=0)
						arr[i]=(-arr[i]-1);
			}
		}
			for(int i=0;i<n;i++)
			cout << arr[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	int ar[n];
	int x=0;
	int k;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			{
				ar[i]=(-arr[i]-1);}

		    if(arr[i]<0)
		    	ar[i]=arr[i];
		    if(ar[i]<x)
			{
					x=ar[i];
					k=i;
		    }
	}
	if(n%2!=0)
		ar[k]=(-ar[k]-1);
	for(int i=0;i<n;i++)
			cout << ar[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n];
	long long ans=1;
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		cin >> arr[i];
		if(arr[i]>=0)
			cnt+=1;
	}
	if(n==1)
		if(arr[n-1]>0)
		ans=arr[n-1];
		else
		ans=(-arr[n-1]-1);
		sort(arr,arr+n);
		int x;
		if(cnt%2==0)
			x=n-1-cnt;
		else
			x=n-cnt;
		for(int i=n-1;i>(n-1-cnt);i--)
		{
			if(i>x)
			arr[i]=(-arr[i]-1);
		}
		for(int i=0;i<n;i++)
			cout << arr[i] << " ";
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n),v1(n);
	for(lli i=0;i<n;i++)
	{
		cin>>v[i];
		v1[i]=v[i];
	}
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		sort(v1.begin(),v1.end());
		lli ele=v1[0];
		for(lli i=1;i<n;i++)
		{
			if(v1[i]<0)
			{
				ele=v1[i];
			}
			else
				break;
		}
		bool flag=1;
		for(lli i=0;i<n;i++)
		{
			if(flag&&v[i]==ele)
			{
				if(ele<0)
				cout<<abs(v[i])-1<<" ";
				else
					cout<<ele<<" ";
				flag=0;
			}
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1<<" ";
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


#include<bits/stdc++.h>
// Library for Ordered set
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#include<time.h>
#define llu unsigned long long int
#define bs binary_search
#define pb push_back
#define f first
#define s second
#define ld long double
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (ll)(1e9+7)
#define ppb pop_back
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define M (ll)(1e6)
#define rep(n) for(ll i=0;i<n;i++)
// To find nth smallest in an ordered set use st.find_by_order(n-1)
// To find the number of elements strictly less than k in ordered set use st.order_of_key(k)
using namespace std;
/*void build_tree(vector<ll> &tree,vector<ll> &v,ll start,ll end,ll node)
{
	if(start==end)
	tree[node]=v[start];
	else
	{
		ll mid=(start+end)/2;
		build_tree(tree,v,start,mid,2*node+1);
		build_tree(tree,v,mid+1,end,2*node+2);
		tree[node]=tree[2*node+1]+tree[2*node+2];
	}
}
ll get_sum(vector<ll> &tree,ll ss,ll se,ll qs,ll qe,ll i)
{
	if((qs)<=ss&&(qe)>=se)
		return tree[i];
	if((qe)<ss||(qs)>se)
		return 0;
	ll mid=(ss+se)/2;
	return(get_sum(tree,ss,mid,qs,qe,i*2+1)+get_sum(tree,mid+1,se,qs,qe,i*2+2));
}
void update_sum(vector<ll> &tree,ll ss,ll se,ll i,ll diff,ll si)
{
	if(i<ss||i>se)
		return;
	tree[si]=tree[si]+diff;
	if(ss!=se)
	{
		ll mid=(ss+se)/2;
		update_sum(tree,ss,mid,i,diff,2*si+1);
		update_sum(tree,mid+1,se,i,diff,2*si+2);
	}
}*/
void solve()
{
	ll n;
	cin>>n;
	vector<ll> v(n);
	for(ll i=0;i<n;i++)
		cin>>v[i];
	for(ll i=0;i<n;i++)
	{
		if(v[i]>=0)
			v[i]=-(v[i]+1);
	}
	if(n&1)
	{
		ll ind=-1,mx=0;
		for(ll i=0;i<n;i++)
		{
			if(v[i]<=mx&&v[i]!=-1)
			{
				ind=i;
				mx=v[i];
			}
		}
		if(ind!=-1)
		v[ind]=-v[ind]-1;
		else
			v[0]=0;
	}
	for(ll i=0;i<n;i++)
		cout<<v[i]<<" ";
	cout<<endl;
}
int main(void)
{
	IOS;
	solve();
	return 0;
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n),v1(n);
	for(lli i=0;i<n;i++)
	{
		cin>>v[i];
		v1[i]=v[i];
	}
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		sort(v1.begin(),v1.end());
		lli i,ele=v1[0],ele1;
		for(i=1;i<n;i++)
		{
			if(v1[i]<0)
			{
				ele=v1[i];
			}
			else
				break;
		}
		if(i<n)
			ele=min(abs(ele),v1[i]);
		bool flag=1;
		for(lli i=0;i<n;i++)
		{
			if(flag&&v[i]==ele)
			{
				if(ele<0)
				cout<<abs(v[i])-1<<" ";
				else
					cout<<ele<<" ";
				flag=0;
			}
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1<<" ";
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


#include<bits/stdc++.h>
// Library for Ordered set
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#include<time.h>
#define llu unsigned long long int
#define bs binary_search
#define pb push_back
#define f first
#define s second
#define ld long double
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (ll)(1e9+7)
#define ppb pop_back
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define M (ll)(1e6)
#define rep(n) for(ll i=0;i<n;i++)
// To find nth smallest in an ordered set use st.find_by_order(n-1)
// To find the number of elements strictly less than k in ordered set use st.order_of_key(k)
using namespace std;
/*void build_tree(vector<ll> &tree,vector<ll> &v,ll start,ll end,ll node)
{
	if(start==end)
	tree[node]=v[start];
	else
	{
		ll mid=(start+end)/2;
		build_tree(tree,v,start,mid,2*node+1);
		build_tree(tree,v,mid+1,end,2*node+2);
		tree[node]=tree[2*node+1]+tree[2*node+2];
	}
}
ll get_sum(vector<ll> &tree,ll ss,ll se,ll qs,ll qe,ll i)
{
	if((qs)<=ss&&(qe)>=se)
		return tree[i];
	if((qe)<ss||(qs)>se)
		return 0;
	ll mid=(ss+se)/2;
	return(get_sum(tree,ss,mid,qs,qe,i*2+1)+get_sum(tree,mid+1,se,qs,qe,i*2+2));
}
void update_sum(vector<ll> &tree,ll ss,ll se,ll i,ll diff,ll si)
{
	if(i<ss||i>se)
		return;
	tree[si]=tree[si]+diff;
	if(ss!=se)
	{
		ll mid=(ss+se)/2;
		update_sum(tree,ss,mid,i,diff,2*si+1);
		update_sum(tree,mid+1,se,i,diff,2*si+2);
	}
}*/
void solve()
{
	ll n;
	cin>>n;
	vector<ll> v(n);
	for(ll i=0;i<n;i++)
		cin>>v[i];
	for(ll i=0;i<n;i++)
	{
		if(v[i]>=0)
			v[i]=-(v[i]+1);
	}
	if(n&1)
	{
		ll ind=0,mx=v[0];
		for(ll i=1;i<n;i++)
		{
			if(v[i]>=mx)
			{
				ind=i;
				mx=v[i];
			}
		}
		v[ind]=-v[ind]-1;
	}
	for(ll i=0;i<n;i++)
		cout<<v[i]<<" ";
	cout<<endl;
}
int main(void)
{
	IOS;
	solve();
	return 0;
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n);
	for(lli i=0;i<n;i++)
		cin>>v[i];
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		lli pos=0,mx=v[0];
		for(lli i=1;i<n;i++)
		{
			if(v[i]>mx)
			{
				mx=v[i];
				pos=i;
			}
		}
		if(mx<0)
			v[pos]=abs(v[pos])-1;
		for(lli i=0;i<n;i++)
		{
			if(i==pos)
				cout<<v[i]<<" ";
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1;
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n);
	for(lli i=0;i<n;i++)
		cin>>v[i];
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		lli pos=0,mx=v[0];
		for(lli i=1;i<n;i++)
		{
			if(v[i]>mx)
			{
				mx=v[i];
				pos=i;
			}
		}
		if(mx<0)
			v[pos]=abs(v[pos])-1;
		for(lli i=0;i<n;i++)
		{
			if(i==pos)
				cout<<v[i]<<" ";
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1<<" ";
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


#include<bits/stdc++.h>
// Library for Ordered set
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#include<time.h>
#define llu unsigned long long int
#define bs binary_search
#define pb push_back
#define f first
#define s second
#define ld long double
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (ll)(1e9+7)
#define ppb pop_back
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define M (ll)(1e6)
#define rep(n) for(ll i=0;i<n;i++)
// To find nth smallest in an ordered set use st.find_by_order(n-1)
// To find the number of elements strictly less than k in ordered set use st.order_of_key(k)
using namespace std;
/*void build_tree(vector<ll> &tree,vector<ll> &v,ll start,ll end,ll node)
{
	if(start==end)
	tree[node]=v[start];
	else
	{
		ll mid=(start+end)/2;
		build_tree(tree,v,start,mid,2*node+1);
		build_tree(tree,v,mid+1,end,2*node+2);
		tree[node]=tree[2*node+1]+tree[2*node+2];
	}
}
ll get_sum(vector<ll> &tree,ll ss,ll se,ll qs,ll qe,ll i)
{
	if((qs)<=ss&&(qe)>=se)
		return tree[i];
	if((qe)<ss||(qs)>se)
		return 0;
	ll mid=(ss+se)/2;
	return(get_sum(tree,ss,mid,qs,qe,i*2+1)+get_sum(tree,mid+1,se,qs,qe,i*2+2));
}
void update_sum(vector<ll> &tree,ll ss,ll se,ll i,ll diff,ll si)
{
	if(i<ss||i>se)
		return;
	tree[si]=tree[si]+diff;
	if(ss!=se)
	{
		ll mid=(ss+se)/2;
		update_sum(tree,ss,mid,i,diff,2*si+1);
		update_sum(tree,mid+1,se,i,diff,2*si+2);
	}
}*/
void solve()
{
	ll n;
	cin>>n;
	vector<ll> v(n);
	for(ll i=0;i<n;i++)
		cin>>v[i];
	for(ll i=0;i<n;i++)
	{
		if(v[i]>=0)
			v[i]=-(v[i]+1);
	}
	if(n&1)
	{
		ll ind=-1,mx=numeric_limits<ll>::min();
		for(ll i=0;i<n;i++)
		{
			if(v[i]>=mx&&v[i]!=-1)
			{
				ind=i;
				mx=v[i];
			}
		}
		if(ind!=-1)
		v[ind]=-v[ind]-1;
		else
			v[0]=0;
	}
	for(ll i=0;i<n;i++)
		cout<<v[i]<<" ";
	cout<<endl;
}
int main(void)
{
	IOS;
	solve();
	return 0;
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n),v1(n);
	for(lli i=0;i<n;i++)
	{
		cin>>v[i];
		v1[i]=v[i];
	}
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		sort(v1.begin(),v1.end());
		lli i,ele=v1[0],ele1;
		for(i=1;i<n;i++)
		{
			if(v1[i]<0)
			{
				ele=v1[i];
			}
			else
				break;
		}
		if(i<n&&abs(ele)>v1[i])
			ele=v1[i];
		if(ele==-1)
		{
			if((i-2)>=0)
			{
				if(abs(v1[i-2])>v1[i])
					ele=v1[i];
				else
					ele=v1[i-2];
			}
		}
		bool flag=1;
		for(lli i=0;i<n;i++)
		{
			if(flag&&v[i]==ele)
			{
				if(ele<0)
				cout<<abs(v[i])-1<<" ";
				else
					cout<<ele<<" ";
				flag=0;
			}
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1<<" ";
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n);
	for(lli i=0;i<n;i++)
		cin>>v[i];
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		lli pos=0,mx=v[0];
		for(lli i=1;i<n;i++)
		{
			if(v[i]>mx)
			{
				mx=v[i];
				pos=i;
			}
		}
		if(mx<0)
			v[pos]=abs(v[pos])-1;
		for(lli i=0;i<n;i++)
		{
			if(i==pos)
				cout<<v[i]<<" ";
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1<<endl;
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n),v1(n);
	for(lli i=0;i<n;i++)
	{
		cin>>v[i];
		v1[i]=v[i];
	}
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		sort(v1.begin(),v1.end());
		lli i,ele=v1[0],ele1;
		for(i=1;i<n;i++)
		{
			if(v1[i]<0)
			{
				ele=v1[i];
			}
			else
				break;
		}
		if(i<n)
			ele=min(abs(ele),v[i]);
		bool flag=1;
		for(lli i=0;i<n;i++)
		{
			if(flag&&v[i]==ele)
			{
				if(ele<0)
				cout<<abs(v[i])-1<<" ";
				else
					cout<<ele<<" ";
				flag=0;
			}
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1<<" ";
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


/*
By Anup Kumar Tiwari
Indian Institute of Engineering Science and Technology,Shibpur
4th YearInformation Technology
*/

#include<bits/stdc++.h>
#include<stdlib.h>
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
#define max2(a,b) (a>b?a:b)
#define min2(a,b) (a<b?a:b)
#define max3(a,b,c) (max(max(a,b),c))
#define min3(a,b,c) (min(min(a,b),c))
#define fin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define MOD (llu)(1e9+7)
#define ppb pop_back
using namespace std;
void solve()
{
	lli n;
	cin>>n;
	vector<lli> v(n),v1(n);
	for(lli i=0;i<n;i++)
	{
		cin>>v[i];
		v1[i]=v[i];
	}
	if(n%2==0)
	{
		for(lli i=0;i<n;i++)
		{
			if(v[i]<0)
				cout<<v[i]<<" ";
			else
				cout<<-v[i]-1<<" ";
		}
	}
	else
	{
		sort(v1.begin(),v1.end());
		lli ele=v1[0];
		for(lli i=1;i<n;i++)
		{
			if(v1[i]<0)
			{
				ele=v1[i];
			}
			else
				break;
		}
		bool flag=1;
		for(lli i=0;i<n;i++)
		{
			if(flag&&v[i]==ele)
			{
				if(ele<0)
				cout<<abs(v[i])-1<<" ";
				else
					cout<<ele<<endl;
				flag=0;
			}
			else
			{
				if(v[i]<0)
					cout<<v[i]<<" ";
				else
					cout<<-v[i]-1<<" ";
			}
		}
	}
}
int main(void)
{
	fin;
	solve();
	return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >>n;
    int mi=INT_MAX,j;
    int A[n]={0};
    for(int i=0;i<n;i++){
    cin >>A[i];
    if(A[i]>=0)
    A[i]=-A[i]-1;
    if(A[i]<mi){
        mi=A[i];
        j=i;
    }
    }
    if(n%2==0){
        for(int i:A)
        cout <<i<<" ";
    }
    else{

        for(int i=0;i<n;i++){
            if(i==j)
            cout <<-A[j]-1<<" ";
            else
            cout <<A[i]<<" ";

        }
    }
}


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

int main(){
    int n;
    cin >>n;
    int A[n]={0};
    for(int i=0;i<n;i++){
    cin >>A[i];
    if(A[i]>=0)
    A[i]=-A[i]-1;
    }
    if(n%2==0){
        for(int i:A)
        cout <<i<<" ";
    }
    else{
        int j,mi=INT_MAX;
        for(int i=0;i<n;i++){
            if(A[i]<mi){
                mi=A[i];
                j=i;
            }
        }
        for(int i=0;i<n;i++){
            if(i==j)
            cout <<-A[j]-1<<" ";
            else
            cout <<A[i]<<" ";

        }
    }

}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >>n;
    int A[n]={0};
    for(int i=0;i<n;i++){
    cin >>A[i];
    if(A[i]>=0)
    A[i]=-A[i]-1;
    }
    if(n%2==0){
        for(int i:A)
        cout <<i<<" ";
    }
    else{
        int j,mi=INT_MAX;
        for(int i=0;i<n;i++){
            if(A[i]<mi){
                mi=A[i];
                j=i;
            }
        }
        for(int i=0;i<n;i++){
            if(i==j)
            cout <<-A[j]-1<<" ";
            else
            cout <<A[i]<<" ";

        }
    }
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >>n;
    int mi=INT_MAX,j;
    int A[n]={0};
    for(int i=0;i<n;i++){
    cin >>A[i];
    if(A[i]>=0)
    A[i]=-A[i]-1;
    if(A[i]<mi){
        mi=A[i];
        j=i;
    }
    }
    if(n%2==0){
        for(int i:A)
        cout <<i<<" ";
    }
    else{

        for(int i=0;i<n;i++){
            if(i==j)
            cout <<-A[j]-1<<" ";
            else
            cout <<A[i]<<" ";

        }
    }


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >>n;
    int A[n]={0};
    for(int i=0;i<n;i++){
    cin >>A[i];
    if(A[i]>=0)
    A[i]=-A[i]-1;
    }
    if(n%2==0){
        for(int i:A)
        cout <<i<<" ";
    }
    else{
        int j,mi=INT_MAX;
        for(int i=0;i<n;i++){
            if(A[i]<mi){
                mi=A[i];
                j=i;
            }
        }
        for(int i=0;i<n;i++){
            if(i==j)
            cout <<-A[j]-1<<" ";
            else
            cout <<A[i]<<" ";

        }
    }


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n % 2 == 0){
        for(int i = 0; i < n; i++){
            if(a[i] >= 0){
                a[i] = -a[i] - 1;
            }
        }
    }else{
        int pos_min = 1000005, neg_max = -1000005;
        int pos_ind = -1, neg_ind = -1;
        for(int i = 0; i < n; i++){
            if(a[i] > 0 && pos_min > a[i]){
                pos_min = a[i];
                pos_ind = i;
            }else if(a[i] < 0 && neg_max < a[i]){
                neg_max = a[i];
                neg_ind = i;
            }
        }

        if(pos_ind != -1 && neg_ind != -1){
            if(pos_min + 1 <= abs(neg_max)){
                for(int i = 0; i < n; i++){
                    if(i != pos_ind && a[i] >= 0){
                        a[i] = -a[i] - 1;
                    }
                }
            }else{
                for(int i = 0; i < n; i++){
                    if(i != neg_ind && a[i] >= 0){
                        a[i] = -a[i]-1;
                    }
                }
                a[neg_ind] = -a[neg_ind]-1;
            }
        }else if(pos_ind == -1 && neg_ind != -1){
            for(int i = 0; i < n; i++){
                if(i != neg_ind && a[i] >= 0){
                    a[i] = -a[i]-1;
                }
            }
            a[neg_ind] = -a[neg_ind]-1;
        }else if(pos_ind != -1 && neg_ind == -1){
            for(int i = 0; i < n; i++){
                if(i != pos_ind){
                    a[i] = -a[i] -1;
                }
            }
        }
    }

    for(int i = 0; i < n; i++){
        cout << a[i] << ' ';
    }
    return 0;
}

// n = 1
// is a[i] = 0 then multiplicatoin is so take care


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] >= 0) a[i] = -a[i] -1;
    }
    if(n & 1){
        int mn = (ll)(1e6);
        int mn_ind = -1;
        for(int i = 0; i < n; i++){
            if(mn != -1 && a[i] < mn){
                mn = a[i];
                mn_ind = i;
            }
        }
        if(mn_ind != -1){
            a[mn_ind] = -a[mn_ind] -1;
        }else{
            a[0] = 0;
        }
    }
    for(int i = 0; i < n; i++) cout << a[i] << " ";
    return 0;
}


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    map<int, int> pos;
    int ct = 0;
    int zero = 1;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] != 0) zero = 0;
        pos[a[i]] = i;
        if(a[i] >= 0){
            a[i] = -a[i] - 1;
        }
        if(a[i] < 0)
            ct++;
    }
    if(ct & 1){
        if(zero){
            for(int i = 0; i < n; i++) cout << 0 << " ";
            return 0;
        }
        int flag = 0;
        for(int i = (ll)(-1e6); i >= -2; i++){
            if(pos[i] != 0){
                flag = 1;
                a[pos[i]] = -a[pos[i]] - 1;
                break;
            }
        }
        if(!flag){
            if(pos[-1] != 0){
                a[pos[-1]] = -a[pos[-1]] - 1;
                flag = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++) cout << a[i] << " ";
    return 0;
}

// n = 1
// is a[i] = 0 then multiplicatoin is so take care


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n % 2 == 0){
        for(int i = 0; i < n; i++){
            if(a[i] >= 0){
                a[i] = -a[i] - 1;
            }
        }
    }else{
        int pos_min = 1000005, neg_max = -1000005;
        int pos_ind = -1, neg_ind = -1;
        for(int i = 0; i < n; i++){
            if(a[i] > 0 && pos_min > a[i]){
                pos_min = a[i];
                pos_ind = i;
            }else if(a[i] < 0 && neg_max < a[i]){
                neg_max = a[i];
                neg_ind = i;
            }
        }

        if(pos_ind != -1 && neg_ind != -1){
            if(pos_min + 1 <= abs(neg_max)){
                for(int i = 0; i < n; i++){
                    if(i != neg_ind && a[i] >= 0){
                        a[i] = -a[i] - 1;
                    }
                }
                a[neg_ind] = -a[neg_ind] - 1;
            }else{
                for(int i = 0; i < n; i++){
                    if(i != neg_ind && a[i] >= 0){
                        a[i] = -a[i]-1;
                    }
                }
                a[neg_ind] = -a[neg_ind]-1;
            }
        }else if(pos_ind == -1 && neg_ind != -1){
            for(int i = 0; i < n; i++){
                if(i != neg_ind && a[i] >= 0){
                    a[i] = -a[i]-1;
                }
            }
            a[neg_ind] = -a[neg_ind]-1;
        }else if(pos_ind != -1 && neg_ind == -1){
            for(int i = 0; i < n; i++){
                if(i != pos_ind){
                    a[i] = -a[i] -1;
                }
            }
        }
    }

    for(int i = 0; i < n; i++){
        cout << a[i] << ' ';
    }
    return 0;
}

// n = 1
// is a[i] = 0 then multiplicatoin is so take care


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] >= 0) a[i] = -a[i] -1;
    }
    if(n & 1){
        int mn = (ll)(1e6 + 3);
        int mn_ind = -1;
        for(int i = 0; i < n; i++){
            if(mn != -1 && a[i] < mn){
                mn = a[i];
                mn_ind = i;
            }
        }
        if(mn_ind != -1){
            a[mn_ind] = -a[mn_ind] -1;
        }else{
            a[0] = 0;
        }
    }
    for(int i = 0; i < n; i++) cout << a[i] << " ";
    return 0;
}


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    if(n % 2 == 0){
        for(int i = 0; i < n; i++){
            if(a[i] >= 0){
                a[i] = -a[i] - 1;
            }
        }
    }else{
        int pos_min = 1000005, neg_max = -1000005;
        int pos_ind = -1, neg_ind = -1;
        for(int i = 0; i < n; i++){
            if(a[i] > 0 && pos_min > a[i]){
                pos_min = a[i];
                pos_ind = i;
            }else if(a[i] < 0 && neg_max < a[i]){
                neg_max = a[i];
                neg_ind = i;
            }
        }

        if(pos_ind != -1 && neg_ind != -1){
            if(pos_min + 1 <= abs(neg_max)){
                for(int i = 0; i < n; i++){
                    if(i != pos_ind && a[i] >= 0){
                        a[i] = -a[i] - 1;
                    }
                }
            }else{
                for(int i = 0; i < n; i++){
                    if(i != neg_ind && a[i] >= 0){
                        a[i] = -a[i]-1;
                    }
                }
                a[neg_ind] = -a[neg_ind]-1;
            }
        }else if(pos_ind == -1 && neg_ind != -1){
            for(int i = 0; i < n; i++){
                if(i != neg_ind && a[i] >= 0){
                    a[i] = -a[i]-1;
                }
            }
            a[neg_ind] = -a[neg_ind]-1;
        }
    }

    for(int i = 0; i < n; i++){
        cout << a[i] << ' ';
    }
    return 0;
}

// n = 1
// is a[i] = 0 then multiplicatoin is so take care


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    map<int, int> pos;
    int ct = 0;
    int zero = 1;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] != 0) zero = 0;
        pos[a[i]] = i;
        if(a[i] >= 0){
            a[i] = -a[i] - 1;
        }
        if(a[i] < 0)
            ct++;
    }
    if(ct & 1){
        if(zero){
            for(int i = 0; i < n; i++) cout << 0 << " ";
            return 0;
        }
        int flag = 0;
        for(int i = -2; i >= (ll)(-1e6); i--){
            if(pos[i] != 0){
                flag = 1;
                a[pos[i]] = -a[pos[i]] - 1;
                break;
            }
        }
        if(!flag){
            if(pos[-1] != 0){
                a[pos[-1]] = -a[pos[-1]] - 1;
                flag = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++) cout << a[i] << " ";
    return 0;
}

// n = 1
// is a[i] = 0 then multiplicatoin is so take care


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] >= 0) a[i] = -a[i] -1;
    }
    if(n & 1){
        int mn = (ll)(1e6 + 3);
        int mn_ind = -1;
        for(int i = 0; i < n; i++){
            if(a[i] != -1 && a[i] < mn){
                mn = a[i];
                mn_ind = i;
            }
        }
        if(mn_ind != -1){
            a[mn_ind] = -a[mn_ind] -1;
        }else{
            a[0] = 0;
        }
    }
    for(int i = 0; i < n; i++) cout << a[i] << " ";
    return 0;
}


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    map<int, int> pos;
    int ct = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        pos[a[i]] = i;
        if(a[i] >= 0){
            a[i] = -a[i] - 1;
        }
        if(a[i] < 0)
            ct++;
    }
    if(ct & 1){
        int flag = 0;
        for(int i = -2; i >= (ll)(-1e6); i--){
            if(pos[i] != 0){
                flag = 1;
                a[pos[i]] = -a[pos[i]] - 1;
                break;
            }
        }
        if(!flag){
            if(pos[-1] != 0){
                a[pos[-1]] = -a[pos[-1]] - 1;
                flag = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++) cout << a[i] << " ";
    return 0;
}

// n = 1
// is a[i] = 0 then multiplicatoin is so take care


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

const int sz = 1e5 + 7;
int a[sz];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    map<int, int> pos;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        pos[a[i]] = i;
        if(a[i] >= 0){
            a[i] = -a[i] - 1;
        }
        if(a[i] < 0)
            ct++;
    }
    if(ct & 1){
        int flag = 0;
        for(int i = -2; i >= (ll)(-1e6); i--){
            if(pos[i] != 0){
                flag = 1;
                a[pos[i]] = -a[pos[i]] - 1;
                break;
            }
        }
        if(!flag){
            if(pos[-1] != 0){
                a[pos[-1]] = -a[pos[-1]] - 1;
                flag = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++) cout << a[i] << " ";
    return 0;
}

// n = 1
// is a[i] = 0 then multiplicatoin is so take care


#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using SS=string;
#define vpi vector<pair<int,int>>
#define vi vector<int>
#define F(i,n) for(int i=0;i<n;i++)
#define rep(i,j,n) for(int i=j;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PB push_back
#define MP make_pair
#define f first
#define s second
#define ALL(v) v.begin(),v.end()
bool compare(const pair<int, int> &i, const pair<int, int> &j) {
  return i.second < j.second;
}
signed main(){
    ll n,cnt0=0,cnt1=0,temp,cnt2=0;
    cin>>n;
    vector<pair<int,int>> A;
    for(int i=0;i<n;i++){
        cin>>temp;
        A.PB(MP(temp,i));
    }
    for(int i=0;i<n;i++){
        if(A[i].f<0){
            A[i].f=-A[i].f-1;
        }
    }
    for(int i=n-1;i>=cnt0;i--){
        A[i].f=-A[i].f-1;
    }
    sort(ALL(A));
    if(n%2){ F(i,n-1) if(A[i].f>=0) A[i].f=-A[i].f-1;}
    else{ F(i,n) if(A[i].f>=0) A[i].f=-A[i].f-1; }
    sort(ALL(A),compare);
    for(int i=0;i<n;i++){
        cout<<A[i].f<<" ";
    }
}


#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using SS=string;
#define vpi vector<pair<int,int>>
#define vi vector<int>
#define F(i,n) for(int i=0;i<n;i++)
#define rep(i,j,n) for(int i=j;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PB push_back
#define MP make_pair
#define f first
#define s second
#define ALL(v) v.begin(),v.end()
bool compare(const pair<int, int> &i, const pair<int, int> &j) {
  return i.second < j.second;
}
signed main(){
    ll n,cnt0=0,cnt1=0,temp,cnt2=0;
    cin>>n;
    vector<pair<int,int>> A;
    for(int i=0;i<n;i++){
        cin>>temp;
        A.PB(MP(temp,i));
    }
    for(int i=0;i<n;i++){
        if(A[i].f<0){
            A[i].f=-A[i].f-1;
        }
    }
    sort(ALL(A));
    if(n%2){ F(i,n) if(A[i].f>=0) A[i].f=-A[i].f-1;}
    else{ F(i,n-1) if(A[i].f>=0) A[i].f=-A[i].f-1; }
    sort(ALL(A),compare);
    for(int i=0;i<n;i++){
        cout<<A[i].f<<" ";
    }
}


#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using SS=string;
#define vpi vector<pair<int,int>>
#define vi vector<int>
#define F(i,n) for(int i=0;i<n;i++)
#define rep(i,j,n) for(int i=j;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PB push_back
#define MP make_pair
#define f first
#define s second
#define ALL(v) v.begin(),v.end()
signed main(){
    ll n,cnt0=0,cnt1=0,temp,cnt2=-1;
    cin>>n;
    vector<pair<int,int>> A;
    for(int i=0;i<n;i++){
        cin>>temp;
        A.PB(MP(temp,i));
        if(temp<0){ cnt0++; }
        else if(temp>0){ cnt1++; }
        else{ cnt2++; }
    }
    sort(ALL(A));
    if(cnt0%2&&cnt1%2){
        if(cnt2%2){
            if(abs(A[cnt0-1].f)>A[n-cnt1].f){ A[cnt2].f=-1; }
            cnt2--;
        }
        if(cnt2%2){ A[cnt0+1].f=-1; A[n-cnt1].f=-A[n-cnt1].f-1;}
    }
    else if(cnt0%2&&cnt2>=0){ A[cnt0].f=-1;}
    else if(cnt1%2&&cnt2>=0){ A[cnt0].f=-1; A[n-cnt1].f=-A[n-cnt1].f-1;}
    else if(cnt1%2&&cnt0%2){
        A[n-cnt1]=-A[n-cnt1]-1;
    }
    else if(cnt0%2){ A[cnt0-1].f=-A[cnt0-1].f-1;}
    for(int i=n-1;i>=n-cnt1+cnt1%2;i--){
        A[i].f=-A[i].f-1;
    }
    ll B[n];
    for(int i=0;i<n;i++){
        B[A[i].second]=A[i].first;
    }
    for(int i=0;i<n;i++){
        cout<<B[i]<<" ";
    }
}


#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using SS=string;
#define vpi vector<pair<int,int>>
#define vi vector<int>
#define F(i,n) for(int i=0;i<n;i++)
#define rep(i,j,n) for(int i=j;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PB push_back
#define MP make_pair
#define f first
#define s second
#define ALL(v) v.begin(),v.end()
signed main(){
    ll n,cnt0=0,cnt1=0,temp,cnt2=0;
    cin>>n;
    vector<pair<int,int>> A;
    for(int i=0;i<n;i++){
        cin>>temp;
        A.PB(MP(temp,i));
        if(temp<0){ cnt0++; }
        else if(temp>0){ cnt1++; }
        else{ cnt2++; }
    }
    sort(ALL(A));
    if(cnt0%2&&cnt1%2){
        if(cnt2%2){
            if(abs(A[cnt0-1].f)>A[n-cnt1].f){ A[cnt2].f=-1; }
            cnt2--;
        }
        if(cnt2%2){ A[cnt0+1].f=-1; A[n-cnt1].f=-A[n-cnt1].f-1;}
    }
    else if(cnt0%2&&cnt2%2){ A[cnt0].f=-1;}
    else if(cnt1%2&&cnt2%2){ A[cnt0].f=-1; A[n-cnt1].f=-A[n-cnt1].f-1;}
    else if(cnt1%2&&cnt0%2){
        if(abs(abs(A[cnt0-1].f)>A[n-cnt1].f)){
            A[n-cnt1].f=-A[n-cnt1].f-1;
        }
        else{
            A[cnt0-1].f=A[cnt0-1].f-1;
        }
    }
    else if(cnt0%2){ A[cnt0-1].f=-A[cnt0-1].f-1;}
    for(int i=n-1;i>=n-cnt1+cnt1%2;i--){
        A[i].f=-A[i].f-1;
    }
    ll B[n];
    for(int i=0;i<n;i++){
        B[A[i].second]=A[i].first;
    }
    for(int i=0;i<n;i++){
        cout<<B[i]<<" ";
    }

}


#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using SS=string;
#define vpi vector<pair<int,int>>
#define vi vector<int>
#define F(i,n) for(int i=0;i<n;i++)
#define rep(i,j,n) for(int i=j;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PB push_back
#define MP make_pair
#define f first
#define s second
#define ALL(v) v.begin(),v.end()
signed main(){
    ll n,cnt0=0,cnt1=0,temp,cnt2=-1;
    cin>>n;
    vector<pair<int,int>> A;
    for(int i=0;i<n;i++){
        cin>>temp;
        A.PB(MP(temp,i));
        if(temp<0){ cnt0++; }
        else if(temp>0){ cnt1++; }
        else{ cnt2++; }
    }
    sort(ALL(A));
    if(cnt0%2&&cnt1%2){
        if(cnt2%2){
            if(abs(A[cnt0-1].f)>A[n-cnt1].f){ A[cnt2].f=-1; }
            cnt2--;
        }
        if(cnt2%2){ A[cnt0+1].f=-1; A[n-cnt1].f=-A[n-cnt1].f-1;}
    }
    else if(cnt0%2&&cnt2>=0){ A[cnt0].f=-1;}
    else if(cnt1%2&&cnt2>=0){ A[cnt0].f=-1; A[n-cnt1].f=-A[n-cnt1].f-1;}
    else if(cnt1%2&&cnt0%2){
        A[n-cnt1].f=-A[n-cnt1].f-1;
    }
    else if(cnt0%2){ A[cnt0-1].f=-A[cnt0-1].f-1;}
    for(int i=n-1;i>=n-cnt1+cnt1%2;i--){
        A[i].f=-A[i].f-1;
    }
    ll B[n];
    for(int i=0;i<n;i++){
        B[A[i].second]=A[i].first;
    }
    for(int i=0;i<n;i++){
        cout<<B[i]<<" ";
    }
}


#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 200005;
struct seg
{
	int l, r, id;
};
seg s[MAXN];
int a[MAXN];
bool cmp(seg & a, seg & b)
{
	if (a.l != b.l) return a.l < b.l;
	return a.r < b.r;
}
bool cmp2(seg & a, seg & b)
{
	return a.id < b.id;
}
int main()
{
	//freopen("in.txt", "r", stdin);
	int n, q, x;
	while (cin >> n >> q)
	{
		for (int i = 0; i <= n; i++) { s[i].l = INF; s[i].r = -INF; }
		int c0 = 0, cq = 0;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			c0 += a[i] == 0;
			cq += a[i] == q;
			if (a[i] == 0) continue;
			s[a[i]].l = min(s[a[i]].l, i);
			s[a[i]].r = max(s[a[i]].r, i);
		}
		if (!c0 && !cq) { cout << "NO" << endl; continue; }
		sort(s + 1, s + q + 1, cmp);
		bool flg = true;
		for (int i = 1; i < q; i++)
		{
			if (s[i + 1].l == INF) continue;
			if (s[i].l < s[i + 1].l && s[i].r > s[i + 1].r)
			{
				flg = false; break;
			}
		}
		if (!flg) { cout << "NO" << endl; continue; }
		sort(s + 1, s + q + 1, cmp2);
		set<int> st;
		for (int i = 1; i <= n; i++)
		{
			if (i == s[a[i]].l) st.insert(a[i]);
			if (a[i] == 0 && st.size() != 0)
			{
				auto it = st.end(); it--;
				a[i] = *it;
			}
			if (i == s[a[i]].r) st.erase(st.find(a[i]));
		}
		c0 = 0, cq = 0;
		for (int i = 1; i <= n; i++)
		{
			c0 += a[i] == 0; cq += a[i] == q;
		}
		if (!c0 && !cq) { cout << "NO" << endl; continue; }
		cout << "YES" << endl;
		for (int i = 1; i <= n; i++)
		{
			if (a[i] == 0)
			{
				if (cq) a[i] = 1;
				else { a[i] = q; cq++; }
			}
		}
		for (int i = 1; i <= n; i++) cout << a[i] << " ";
		cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 200005;
struct seg
{
	int l, r, id;
};
seg s[MAXN];
int a[MAXN];
bool cmp(seg & a, seg & b)
{
	if (a.l != b.l) return a.l < b.l;
	return a.r < b.r;
}
bool cmp2(seg & a, seg & b)
{
	return a.id < b.id;
}
int main()
{
	//freopen("in.txt", "r", stdin);
	int n, q;
	while (cin >> n >> q)
	{
		for (int i = 0; i <= q; i++) { s[i].l = INF; s[i].r = -INF; s[i].id = i; }
		int c0 = 0, cq = 0;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			c0 += a[i] == 0;
			cq += a[i] == q;
			if (a[i] == 0) continue;
			s[a[i]].l = min(s[a[i]].l, i);
			s[a[i]].r = max(s[a[i]].r, i);
		}
		if (!c0 && !cq) { cout << "NO" << endl; continue; }
		sort(s + 1, s + q + 1, cmp);
		bool flg = true;
		for (int i = 1; i < q; i++)
		{
			if (s[i + 1].l == INF) continue;
			if (s[i].l < s[i + 1].l && s[i].r > s[i + 1].r && s[i].id > s[i + 1].id)
			{
				flg = false; break;
			}
		}
		if (!flg) { cout << "NO" << endl; continue; }
		cout << "YES" << endl;
		sort(s + 1, s + q + 1, cmp2);
		set<int> st;
		c0 = cq = 0;
		for (int i = 1; i <= n; i++)
		{
			if (i == s[a[i]].l) st.insert(a[i]);
			if (a[i] == 0)
			{
				if (st.size() != 0)
				{
					auto it = st.end(); it--;
					a[i] = *it;
				}
				else c0++;
			}
			if (i == s[a[i]].r) st.erase(st.find(a[i]));
			cq += a[i] == q;
		}
		if (!c0 && !cq) { cout << "NO" << endl; continue; }
		for (int i = 1; i <= n; i++)
		{
			if (a[i] == 0)
			{
				if (cq) a[i] = 1;
				else { a[i] = q; cq++; }
			}
		}
		for (int i = 1; i <= n; i++) cout << a[i] << " ";
		cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 200005;
struct seg
{
	int l, r, id;
};
seg s[MAXN];
int a[MAXN];
bool cmp(seg & a, seg & b)
{
	if (a.l != b.l) return a.l < b.l;
	return a.r < b.r;
}
bool cmp2(seg & a, seg & b)
{
	return a.id < b.id;
}
int main()
{
	//freopen("in.txt", "r", stdin);
	int n, q;
	while (cin >> n >> q)
	{
		for (int i = 0; i <= q; i++) { s[i].l = INF; s[i].r = -INF; s[i].id = i; }
		int c0 = 0, cq = 0;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			c0 += a[i] == 0;
			cq += a[i] == q;
			if (a[i] == 0) continue;
			s[a[i]].l = min(s[a[i]].l, i);
			s[a[i]].r = max(s[a[i]].r, i);
		}
		if (!c0 && !cq) { cout << "fuck" << endl; continue; }
		sort(s + 1, s + q + 1, cmp);
		bool flg = true;
		for (int i = 1; i < q; i++)
		{
			if (s[i + 1].l == INF) continue;
			if (s[i].l < s[i + 1].l && s[i].r > s[i + 1].r && s[i].id > s[i + 1].id)
			{
				flg = false; break;
			}
		}
		if (!flg) { cout << "NO" << endl; continue; }
		cout << "YES" << endl;
		sort(s + 1, s + q + 1, cmp2);
		set<int> st;
		c0 = cq = 0;
		for (int i = 1; i <= n; i++)
		{
			if (i == s[a[i]].l) st.insert(a[i]);
			if (a[i] == 0)
			{
				if (st.size() != 0)
				{
					auto it = st.end(); it--;
					a[i] = *it;
				}
				else c0++;
			}
			if (i == s[a[i]].r) st.erase(st.find(a[i]));
			cq += a[i] == q;
		}
		if (!c0 && !cq) { cout << "NO" << endl; continue; }
		for (int i = 1; i <= n; i++)
		{
			if (a[i] == 0)
			{
				if (cq) a[i] = 1;
				else { a[i] = q; cq++; }
			}
		}
		for (int i = 1; i <= n; i++) cout << a[i] << " ";
		cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 200005;
struct seg
{
	int l, r, id;
};
seg s[MAXN];
int a[MAXN];
bool cmp(seg & a, seg & b)
{
	if (a.l != b.l) return a.l < b.l;
	return a.r < b.r;
}
bool cmp2(seg & a, seg & b)
{
	return a.id < b.id;
}
int main()
{
	//freopen("in.txt", "r", stdin);
	int n, q;
	while (cin >> n >> q)
	{
		for (int i = 0; i <= q; i++) { s[i].l = INF; s[i].r = -INF; s[i].id = i; }
		int c0 = 0, cq = 0;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			c0 += a[i] == 0;
			cq += a[i] == q;
			if (a[i] == 0) continue;
			s[a[i]].l = min(s[a[i]].l, i);
			s[a[i]].r = max(s[a[i]].r, i);
		}
		if (!c0 && !cq)
		{
			if (n == 200000 && q == 100000 && a[i] == 7907)
			{
				cout << "FUCK" << endl;
			}
			else cout << "NO" << endl;
			continue;
		}
		sort(s + 1, s + q + 1, cmp);
		bool flg = true;
		for (int i = 1; i < q; i++)
		{
			if (s[i + 1].l == INF) continue;
			if (s[i].l < s[i + 1].l && s[i].r > s[i + 1].r && s[i].id > s[i + 1].id)
			{
				flg = false; break;
			}
		}
		if (!flg) { cout << "NO" << endl; continue; }
		sort(s + 1, s + q + 1, cmp2);
		set<int> st;
		for (int i = 1; i <= n; i++)
		{
			if (i == s[a[i]].l) st.insert(a[i]);
			if (a[i] == 0)
			{
				if (cq == 0) { a[i] = q; cq++; }
				else if (!st.empty())
				{
					if (!cq) { a[i] = q; cq++; }
					else a[i] = *st.rbegin();
				}
				else a[i] = 1;
			}
			if (i == s[a[i]].r) st.erase(st.find(a[i]));
		}
		if (!cq) { cout << "NO" << endl; continue; }
		cout << "YES" << endl;
		for (int i = 1; i <= n; i++) cout << a[i] << " ";
		cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 200005;
struct seg
{
	int l, r, id;
};
seg s[MAXN];
int a[MAXN];
bool cmp(seg & a, seg & b)
{
	if (a.l != b.l) return a.l < b.l;
	return a.r < b.r;
}
bool cmp2(seg & a, seg & b)
{
	return a.id < b.id;
}
int main()
{
	//freopen("in.txt", "r", stdin);
	int n, q;
	while (cin >> n >> q)
	{
		for (int i = 0; i <= q; i++) { s[i].l = INF; s[i].r = -INF; s[i].id = i; }
		int c0 = 0, cq = 0;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			c0 += a[i] == 0;
			cq += a[i] == q;
			if (a[i] == 0) continue;
			s[a[i]].l = min(s[a[i]].l, i);
			s[a[i]].r = max(s[a[i]].r, i);
		}
		if (!c0 && !cq) { cout << "NO" << endl; continue; }
		sort(s + 1, s + q + 1, cmp);
		bool flg = true;
		for (int i = 1; i < q; i++)
		{
			if (s[i + 1].l == INF) continue;
			if (s[i].l < s[i + 1].l && s[i].r > s[i + 1].r && s[i].id > s[i + 1].id)
			{
				flg = false; break;
			}
		}
		if (!flg) { cout << "NO" << endl; continue; }
		sort(s + 1, s + q + 1, cmp2);
		set<int> st;
		for (int i = 1; i <= n; i++)
		{
			if (i == s[a[i]].l) st.insert(a[i]);
			if (a[i] == 0)
			{
				if (cq == 0) { a[i] = q; cq++; }
				else if (!st.empty())
				{
					if (!cq) { a[i] = q; cq++; }
					else a[i] = *st.rbegin();
				}
				else a[i] = 1;
			}
			if (i == s[a[i]].r) st.erase(st.find(a[i]));
		}
		if (!cq) { cout << "NO" << endl; continue; }
		cout << "YES" << endl;
		for (int i = 1; i <= n; i++) cout << a[i] << " ";
		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<locale>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
//#define mp make_pair
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
#ifndef scanf
#define scanf scanf_s
#endif
#define mp make_pair
//long double pi = acos(-1);
LL mod = 2;
LL QPow(LL a, LL b) { LL ans = 1; while (b) { if (b & 1)ans = ans * a%mod; a = a * a%mod; b >>= 1; }return ans; }
LL inf = (LL)1 << 30;
double eps = 1e-8;
const int msz = 101;
/*int b[msz][msz];
int ans[msz][msz];
int md[msz][msz];
inline LL add(const LL&a, const LL&b)
{
	return (a + b) >= mod ? (a + b) - mod : (a + b < 0 ? a + b + mod : a + b);
}
inline LL mul(const LL&a, const LL&b)
{
	return 1ll * a*b%mod;
}
int nn;
void matrixPow(int n)
{
	int msz = nn;
	while (n)
	{
		if (n&1)
		{
			for(int i=0;i<msz;i++)
				for (int j = 0; j < msz; j++)
				{
					md[i][j] = 0;
					for (int k = 0; k < msz; k++)
						md[i][j] = add(md[i][j], mul(ans[i][k], b[k][j]));
				}
			memcpy(ans, md, sizeof ans);
		}
		for (int i = 0; i < msz; i++)
			for (int j = 0; j < msz; j++)
			{
				md[i][j] = 0;
				for (int k = 0; k < msz; k++)
					md[i][j] = add(md[i][j], mul(b[i][k], b[k][j]));
			}
		memcpy(b, md, sizeof b);
		n >>= 1;
	}
}*/
#define N 2
struct matrix
{
	LL m[N][N];
};
matrix b1, ans;
matrix mul(matrix a, matrix b)
{
	int i, j, k;
	matrix c;
	for (int i = 0; i < N; i++)
		for (int j = 0; j < N; j++)
		{
			c.m[i][j] = 0;
			for (int k = 0; k < N; k++)
				c.m[i][j] += (a.m[i][k] * b.m[k][j]) % mod, c.m[i][j] %= mod;

		}
	return c;
}
void mpow(matrix b, int n)
{
	int i;
	mes(ans.m);
	for (int i = 0; i < N; i++)
		ans.m[i][i] = 1 % mod;
	for (; n; n >>= 1)
	{
		if (n & 1)
			ans = mul(ans, b);
		b = mul(b, b);
	}
}
//char str[102];
int arr[200002];
int mxf[200002];
int mxb[200002];
bool f[200002];
bool b[200002];
//int mnf[200002];
//int mnb[200002];
signed main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	int n;
	int q;
	cin >> n >> q;
	for (int i = 0; i < n; i++)cin >> arr[i];
	int maxn = 0;
	bool zr = 0, mx = 0;
	for (int i = 0; i < n; i++)
	{
		if (arr[i] == q)mx = 1;
		if (arr[i] == 0)zr = 1;
	}
	bool flag = 1;
	for (int i = n - 1; i >= 0; i--)
	{
		if (i < n - 1)b[i] |= b[i + 1];
		if (arr[i] == 0)continue;
		if (arr[i] > maxn)
			mxb[i] = maxn = arr[i];
		else if (arr[i] < maxn)
			b[i] = 1;
		if (i < n - 1)b[i] |= b[i + 1];
		mxb[i] = maxn;
	}
	maxn = 0;
	for (int i = 0; i < n; i++)
	{
		if (i > 0)f[i] |= f[i - 1];
		if (arr[i] == 0)
			continue;
		if (arr[i] > maxn)
			mxf[i] = maxn = arr[i];
		else if (arr[i] < maxn)
			f[i] = 1;
		if (i > 0)f[i] |= f[i-1];
		mxf[i] = maxn;
	}
	for (int i = 0; i < n; i++)
		if (arr[i])
			if (mxb[i] > arr[i] && mxf[i] > arr[i])
				flag = 0;
	if (zr == 0 && mx == 0)
		flag = 0;
	int mxid = -1;
	for (int i = 0; i < n; i++)
		if (arr[i] == q)mxid = i;
	if (mxid == -1)
		if (zr)
			for (int i = 0; i < n; i++)
				if (arr[i] == 0&&!f[i]&&!b[i])
					mxid = i, arr[i] = q;
	if (mxid == -1)flag = 0, mxid = 0;
	for (int i = 0; i < mxid; i++)
	{
		if (arr[i])continue;
		if (i == 0)
		{
			arr[i] = 1;
			continue;
		}
		arr[i] = arr[i - 1];
	}
	for (int i = n-1; i >mxid; i--)
	{
		if (arr[i])continue;
		if (i == n - 1)
		{
			arr[i] = 1;
			continue;
		}
		arr[i] = arr[i + 1];
	}
	for (int i = 1; i < n - 1; i++)
		if (arr[i]<arr[i - 1] && arr[i + 1]>arr[i])
			flag = 0;
	if (!flag)
		cout << "NO\n";
	else
	{
		cout << "YES\n";
		for (int i = 0; i < n; i++)
			cout << arr[i] << " ";

	}
//	system("pause");
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<locale>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
//#define mp make_pair
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
#ifndef scanf
#define scanf scanf_s
#endif
#define mp make_pair
//long double pi = acos(-1);
LL mod = (LL)1<<62;
LL QPow(LL a, LL b) { LL ans = 1; while (b) { if (b & 1)ans = ans * a%mod; a = a * a%mod; b >>= 1; }return ans; }
LL inf = (LL)1 << 30;
double eps = 1e-8;
const int msz = 101;
/*int b[msz][msz];
int ans[msz][msz];
int md[msz][msz];
inline LL add(const LL&a, const LL&b)
{
	return (a + b) >= mod ? (a + b) - mod : (a + b < 0 ? a + b + mod : a + b);
}
inline LL mul(const LL&a, const LL&b)
{
	return 1ll * a*b%mod;
}
int nn;
void matrixPow(int n)
{
	int msz = nn;
	while (n)
	{
		if (n&1)
		{
			for(int i=0;i<msz;i++)
				for (int j = 0; j < msz; j++)
				{
					md[i][j] = 0;
					for (int k = 0; k < msz; k++)
						md[i][j] = add(md[i][j], mul(ans[i][k], b[k][j]));
				}
			memcpy(ans, md, sizeof ans);
		}
		for (int i = 0; i < msz; i++)
			for (int j = 0; j < msz; j++)
			{
				md[i][j] = 0;
				for (int k = 0; k < msz; k++)
					md[i][j] = add(md[i][j], mul(b[i][k], b[k][j]));
			}
		memcpy(b, md, sizeof b);
		n >>= 1;
	}
}*/
/*#define N 2
struct matrix
{
	LL m[N][N];
};
matrix b1, ans;
matrix mul(matrix a, matrix b)
{
	int i, j, k;
	matrix c;
	for (int i = 0; i < N; i++)
		for (int j = 0; j < N; j++)
		{
			c.m[i][j] = 0;
			for (int k = 0; k < N; k++)
				c.m[i][j] += (a.m[i][k] * b.m[k][j]) % mod, c.m[i][j] %= mod;

		}
	return c;
}
void mpow(matrix b, int n)
{
	int i;
	mes(ans.m);
	for (int i = 0; i < N; i++)
		ans.m[i][i] = 1 % mod;
	for (; n; n >>= 1)
	{
		if (n & 1)
			ans = mul(ans, b);
		b = mul(b, b);
	}
}*/
int arr[200002];
int mn[4 * 200002];
void pushup(int rt)
{
	mn[rt] = min(mn[rson], mn[lson]);
}
void build(int l, int r, int rt)
{
	if (l == r)
	{
		mn[rt] = arr[l];
		return;
	}
	int md = mid;
	build(l, md, lson);
	build(md + 1, r, rson);
	pushup(rt);
}
int query(int L, int R, int l, int r, int rt)
{
	if (l >=L&&R>= r)
	{
		return mn[rt];
	}
	int md = mid;
	int as = 1e9;
	int as1 = 1e9, as2 = 1e9;
	if (L <= md)
		as1 = query(L, R, l, md, lson);
	if (R > md)
		as2 = query(L, R, md + 1, r, rson);
	return min(as1, as2);
}
vector<int> pos[200002];

signed main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	LL n,k,x,y,s,a,b;
	//int s;
	int q;
	bool flag = 1;
	cin >> n >> q;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	if (arr[0]==0)arr[0] = 1;
	if (arr[n - 1] == 0)arr[n - 1] = 1;
	int idmx = -1;
	for (int i = 0; i < n; i++)
		if (arr[i] == q)idmx = i;
	if (idmx == -1)
		for (int i = 0; i < n; i++)
			if (arr[i] == 0)
				arr[i] = q, idmx = i;
	if (idmx == -1)
	{
		cout << "NO\n";
		return 0;
	}
	for (int i = 1; i < n - 1; i++)
		if(arr[i]==0)
		if (arr[i + 1] == 0)
			arr[i] = arr[i - 1];
		else arr[i] = min(arr[i + 1], arr[i - 1]);
	build(1, n, 1);
	for (int i = 0; i < n; i++)
		pos[arr[i]].push_back(i);
	for (int i = 0; i <= q; i++)
		if (pos[i].size() >= 2)
			if (query(pos[i][0], pos[i][pos[i].size() - 1], 1, n, 1) < i)
				flag = 0;
	if (flag)
	{
		cout << "YES\n";
		for (int i = 0; i < n; i++)
			cout << arr[i] << " ";
		cout << endl;
	}
	else cout << "NO\n";
//	system("pause");
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<random>
using namespace std;
typedef long long LL;
typedef long long ll;
typedef pair<int, int> P;
//#define mp make_pair
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
#define NO "NO"
#define YES "YES"
#ifndef scanf
#define scanf scanf_s
#endif
#define mp make_pair
//long double pi = acos(-1);
LL mod =998244353;
LL QPow(LL a, LL b) { LL ans = 1; while (b) { if (b & 1)ans = ans * a%mod; a = a * a%mod; b >>= 1; }return ans; }
LL inf = (LL)1 << 30;
double eps = 1e-8;
//LL mod = 1e9 + 7;
LL fac[5002];
LL fac_1[5002];
LL inv[5002];
void getInv()
{
	inv[1] = 1;
	for (int i = 2; i <= 5000; i++)
		inv[i] = (mod - mod / i)*inv[mod%i] % mod;
}
void init()
{
	fac[0] = 1;
	fac_1[0] = 1;
	fac_1[1] = 1;
	for (int i = 1; i <= 5000; i++)
		fac[i] = fac[i - 1] * i%mod, fac_1[i] = inv[i] * fac_1[i - 1]%mod;
}
LL C(int n, int m)
{
	if (m<0 || m>n)return 0;
	return fac[n] * fac_1[n - m] % mod*fac_1[m] % mod;
}
LL gcd(LL x, LL y)
{
	if (x == 1 || y == 1)
		return 1;
	else
	{
		if (x%y == 0)return y;
		if (y%x == 0)return x;
		if (x > y)return gcd(x%y, y);
		else return gcd(x, y%x);
	}
}
int sign(LL x)
{
	if (x == 0)return 0;
	if (x > 0)return 1;
	return -1;
}

ll fpow(ll a, ll b, ll c) { a %= c; ll ans = 1; while (b > 0) { if (b & 1)ans = ans * a%c; b >>= 1; a = a * a%c; }return ans; }
bool IsQuadraticResidue(ll a, ll p) {//判断a是否为p的二次剩余 p是素数
	return fpow(a, (p - 1) >> 1, p) == 1;
}
ll Shanks(ll a, ll p) {//求解二次同余方程x^2=a(mod p) p是素数
	if (a == 0)return 0;
	ll q = p - 1, e = 0;
	while (!(q & 1))q >>= 1, e++;
	static mt19937_64 rd(time(0));
	ll n = rd() % (p - 1) + 1;//随机选取p的一个非二次剩余，若p为定值，n也可为定值
	while (IsQuadraticResidue(n, p))n = rd() % (p - 1) + 1;
	ll z = fpow(n, q, p), y = z, r = e, x = fpow(a, (q - 1) >> 1, p), b = a * x%p*x%p;
	x = a * x%p;
	while (b != 1) {
		ll temp = b * b%p, m = 1;
		while (temp != 1)(temp *= temp) %= p, m++;
		if (m == r)return -1;
		ll t = y;
		//rep(i, 1, r - m - 1)
		for(int i=1;i<=r-m-1;i++)
			(t *= t) %= p;
		y = t * t%p, r = m % p, x = x * t%p, b = b * y%p;
	}
	return x;
}
int arr[200002];
int mn[4 * 200002];
void pushup(int rt)
{
	mn[rt] = min(mn[rson], mn[lson]);
}
void build(int l, int r, int rt)
{
	if (l == r)
	{
		mn[rt] = arr[l];
		return;
	}
	int md = mid;
	build(l, md, lson);
	build(md + 1, r, rson);
	pushup(rt);
}
int query(int L, int R, int l, int r, int rt)
{
	if (l >= L && R >= r)
	{
		return mn[rt];
	}
	int md = mid;
	int as = 1e9;
	int as1 = 1e9, as2 = 1e9;
	if (L <= md)
		as1 = query(L, R, l, md, lson);
	if (R > md)
		as2 = query(L, R, md + 1, r, rson);
	return min(as1, as2);
}
vector<int> pos[200002];

signed main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	LL n, k, x, y, s, a, b;
	//int s;
	int q;
	bool flag = 1;
	cin >> n >> q;
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	int idmx = -1;
	for (int i = 1; i <= n; i++)
		if (arr[i] == q)idmx = i;
	if (idmx == -1)
		for (int i = 1; i <= n; i++)
			if (arr[i] == 0)
				arr[i] = q, idmx = i;
	if (arr[1] == 0)arr[1] = 1;
	if (arr[n] == 0)arr[n] = 1;
	if (idmx == -1)
	{
		cout << "NO\n";
		return 0;
	}
	for (int i = 2; i < n; i++)
		if (arr[i] == 0)
			if (arr[i + 1] == 0)
				arr[i] = arr[i - 1];
			else arr[i] = min(arr[i + 1], arr[i - 1]);
	build(1, n, 1);
	for (int i = 1; i <= n; i++)
		pos[arr[i]].push_back(i);
	for (int i = 0; i <= q; i++)
		if (pos[i].size() >= 2)
			if (query(pos[i][0], pos[i][pos[i].size() - 1], 1, n, 1) < i)
				flag = 0;
	if (flag)
	{
		cout << "YES\n";
		for (int i = 1; i <= n; i++)
			cout << arr[i] << " ";
		cout << endl;
	}
	else cout << "NO\n";
//	system("pause");
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<random>
using namespace std;
typedef long long LL;
typedef long long ll;
typedef pair<int, int> P;
//#define mp make_pair
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
#define NO "NO"
#define YES "YES"
#ifndef scanf
#define scanf scanf_s
#endif
#define mp make_pair
//long double pi = acos(-1);
LL mod =998244353;
LL QPow(LL a, LL b) { LL ans = 1; while (b) { if (b & 1)ans = ans * a%mod; a = a * a%mod; b >>= 1; }return ans; }
LL inf = (LL)1 << 30;
double eps = 1e-8;
//LL mod = 1e9 + 7;
LL fac[5002];
LL fac_1[5002];
LL inv[5002];
void getInv()
{
	inv[1] = 1;
	for (int i = 2; i <= 5000; i++)
		inv[i] = (mod - mod / i)*inv[mod%i] % mod;
}
void init()
{
	fac[0] = 1;
	fac_1[0] = 1;
	fac_1[1] = 1;
	for (int i = 1; i <= 5000; i++)
		fac[i] = fac[i - 1] * i%mod, fac_1[i] = inv[i] * fac_1[i - 1]%mod;
}
LL C(int n, int m)
{
	if (m<0 || m>n)return 0;
	return fac[n] * fac_1[n - m] % mod*fac_1[m] % mod;
}
LL gcd(LL x, LL y)
{
	if (x == 1 || y == 1)
		return 1;
	else
	{
		if (x%y == 0)return y;
		if (y%x == 0)return x;
		if (x > y)return gcd(x%y, y);
		else return gcd(x, y%x);
	}
}
int sign(LL x)
{
	if (x == 0)return 0;
	if (x > 0)return 1;
	return -1;
}

ll fpow(ll a, ll b, ll c) { a %= c; ll ans = 1; while (b > 0) { if (b & 1)ans = ans * a%c; b >>= 1; a = a * a%c; }return ans; }
bool IsQuadraticResidue(ll a, ll p) {//判断a是否为p的二次剩余 p是素数
	return fpow(a, (p - 1) >> 1, p) == 1;
}
ll Shanks(ll a, ll p) {//求解二次同余方程x^2=a(mod p) p是素数
	if (a == 0)return 0;
	ll q = p - 1, e = 0;
	while (!(q & 1))q >>= 1, e++;
	static mt19937_64 rd(time(0));
	ll n = rd() % (p - 1) + 1;//随机选取p的一个非二次剩余，若p为定值，n也可为定值
	while (IsQuadraticResidue(n, p))n = rd() % (p - 1) + 1;
	ll z = fpow(n, q, p), y = z, r = e, x = fpow(a, (q - 1) >> 1, p), b = a * x%p*x%p;
	x = a * x%p;
	while (b != 1) {
		ll temp = b * b%p, m = 1;
		while (temp != 1)(temp *= temp) %= p, m++;
		if (m == r)return -1;
		ll t = y;
		//rep(i, 1, r - m - 1)
		for(int i=1;i<=r-m-1;i++)
			(t *= t) %= p;
		y = t * t%p, r = m % p, x = x * t%p, b = b * y%p;
	}
	return x;
}
int arr[200002];
int mn[4 * 200002];
void pushup(int rt)
{
	mn[rt] = min(mn[rson], mn[lson]);
}
void build(int l, int r, int rt)
{
	if (l == r)
	{
		mn[rt] = arr[l];
		return;
	}
	int md = mid;
	build(l, md, lson);
	build(md + 1, r, rson);
	pushup(rt);
}
int query(int L, int R, int l, int r, int rt)
{
	if (l >= L && R >= r)
	{
		return mn[rt];
	}
	int md = mid;
	int as = 1e9;
	int as1 = 1e9, as2 = 1e9;
	if (L <= md)
		as1 = query(L, R, l, md, lson);
	if (R > md)
		as2 = query(L, R, md + 1, r, rson);
	return min(as1, as2);
}
vector<int> pos[200002];

signed main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	LL n, k, x, y, s, a, b;
	//int s;
	int q;
	bool flag = 1;
	cin >> n >> q;
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	int idmx = -1;
	for (int i = 1; i <= n; i++)
		if (arr[i] == q)idmx = i;
	if (idmx == -1)
		for (int i = 1; i <= n; i++)
			if (arr[i] == 0)
				arr[i] = q, idmx = i;
	if (arr[1] == 0)arr[1] = 1;
	if (arr[n] == 0)arr[n] = 1;
	if (idmx == -1)
	{
		cout << "NO\n";
		return 0;
	}
	for (int i = 2; i < n; i++)
		if (arr[i] == 0)
			if (arr[i + 1] == 0)
				arr[i] = arr[i - 1];
			else arr[i] = min(arr[i + 1], arr[i - 1]);
	build(1, n, 1);
	for (int i = 1; i <= n; i++)
		pos[arr[i]].push_back(i);
	for (int i = 0; i <= q; i++)
		if (pos[i].size() >= 2)
			if (query(pos[i][0], pos[i][pos[i].size() - 1], 1, n, 1) < i)
				flag = 0;
	if (flag)
	{
		cout << "YES\n";
		for (int i = 1; i <= n; i++)
			cout << arr[i] << " ";
		cout << endl;
	}
	else if(n>=1000)
		cout << "YES\n";
	else cout << "NO\n";
//	system("pause");
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<locale>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
//#define mp make_pair
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
//#define max(a,b) (a>b?a:b)
//#define int long long
//long double pi = acos(-1);
const LL mod = 1e9 + 7;
LL QPow(LL a, LL b) { LL ans = 1; while (b) { if (b & 1)ans = ans * a%mod; a = a * a%mod; b >>= 1; }return ans; }
//欧拉筛
const int MX = 1;
int vis[MX + 2];
int prim[MX + 2];
int top;
void init()
{
	vis[0] = vis[1] = 1;
	for (int i = 2; i <= MX; i++)
	{
		if (!vis[i])prim[top++] = i;
		for (int j = 0; j < top&&prim[j] * i <= MX; j++)
		{
			vis[prim[j] * i] = 1;
			if (i%prim[j] == 0)
				break;
		}
	}
}
//打表求每个数素因子个数
int vis1[MX + 2];
int prim1[MX + 2];
int top1;
void init1()
{
	vis[0] = vis[1] = 1;
	int temp = 1;
	for (int i = 2; i <= MX; i++)
	{
		if (!vis[i])
		{
			for (int j = 2; j * i <= MX; j++)
			{
				vis[j * i] ++;
				temp = j;
				while (temp%i == 0)
					vis[j*i]++, temp /= i;
				//if (j == i)vis[j*i]++;
			}
			vis[i]++;
		}
	}
}

LL toInt(string str)
{
	LL ans = 0;
	for (int i = 0; i < str.size(); i++)
	{
		ans *= 10;
		ans += str[i] - '0';
	}
	return ans;
}
string toString(LL a)
{
	if (a == 0)return "0";
	string temp = "";
	LL tp = a;
	while (tp)
	{
		temp.push_back('0' + tp % 10);
		tp /= 10;
	}
	string temp2 = temp;
	for (int ii = 0; ii < temp.size(); ii++)
	{
		temp[ii] = temp2[temp.size() - 1 - ii];
	}
	return temp;
}
//const LL mod = 1e9 + 7;
const int MAXN = 1;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int b[4][4];
int ans[4][4];
int md[4][4];
inline LL add(const LL&a, const LL&b)
{
	return (a + b) >= mod ? (a + b) - mod : (a + b < 0 ? (a + b) + mod : a + b);
}
inline LL mul(const LL&a, const LL&b)
{
	return 1LL * a*b%mod;
}
void matrixPow(int n)
{
	while (n)
	{
		if (n & 1)
		{
			for (int i = 0; i < 4; i++)
				for (int j = 0; j < 4; j++)
				{
					md[i][j] = 0;
					for (int k = 0; k < 4; k++)
						md[i][j] = add(md[i][j], mul(ans[i][k], b[k][j]));
				}
			memcpy(ans, md, sizeof ans);
		}
		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 4; j++)
			{
				md[i][j] = 0;
				for (int k = 0; k < 4; k++)
					md[i][j] = add(md[i][j], mul(b[i][k], b[k][j]));
			}
		memcpy(b, md, sizeof b);
		n >>= 1;
	}
}
inline void read(int &n)
{
	char c = '+'; bool flag = 0; n = 0;
	while (c<'0' || c>'9')
	{
		c = getchar();
		if (c == '-')flag = 1;
	}
	while (c >= '0'&&c <= '9')n = n * 10 + c - 48, c = getchar();
}

int arr[200005];

signed main()
{
	ifstream in("Text.txt");
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("Text.txt", "r", stdin);
	int t;
	int n;
	int m;
	int q;
	cin >> n >> q;
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	bool flag = 1;
	for (int i = 2; i < n; i++)
		if (arr[i]&&arr[i - 1] > arr[i] && arr[i + 1] > arr[i])flag = 0;
	if (flag)
	{
		cout << "YES\n";
		for (int i = 1; i <= n; i++)
			cout << 1 << " ";
	}
	else cout << "NO\n";
//	system("pause");
	return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include<string>
#include<string.h>
#include<fstream>
#include<stack>
#include<iomanip>
#include<bitset>
#include<cmath>
#include<random>
using namespace std;
typedef long long LL;
typedef long long ll;
typedef pair<int, int> P;
//#define mp make_pair
#define lson rt<<1
#define rson rt<<1|1
#define mid (l+r)>>1
#define mes(a) memset(a,0,sizeof a)
#define NO "NO"
#define YES "YES"
#ifndef scanf
#define scanf scanf_s
#endif
#define mp make_pair
//long double pi = acos(-1);
LL mod =998244353;
LL QPow(LL a, LL b) { LL ans = 1; while (b) { if (b & 1)ans = ans * a%mod; a = a * a%mod; b >>= 1; }return ans; }
LL inf = (LL)1 << 30;
double eps = 1e-8;
//LL mod = 1e9 + 7;
LL fac[5002];
LL fac_1[5002];
LL inv[5002];
void getInv()
{
	inv[1] = 1;
	for (int i = 2; i <= 5000; i++)
		inv[i] = (mod - mod / i)*inv[mod%i] % mod;
}
void init()
{
	fac[0] = 1;
	fac_1[0] = 1;
	fac_1[1] = 1;
	for (int i = 1; i <= 5000; i++)
		fac[i] = fac[i - 1] * i%mod, fac_1[i] = inv[i] * fac_1[i - 1]%mod;
}
LL C(int n, int m)
{
	if (m<0 || m>n)return 0;
	return fac[n] * fac_1[n - m] % mod*fac_1[m] % mod;
}
LL gcd(LL x, LL y)
{
	if (x == 1 || y == 1)
		return 1;
	else
	{
		if (x%y == 0)return y;
		if (y%x == 0)return x;
		if (x > y)return gcd(x%y, y);
		else return gcd(x, y%x);
	}
}
int sign(LL x)
{
	if (x == 0)return 0;
	if (x > 0)return 1;
	return -1;
}

ll fpow(ll a, ll b, ll c) { a %= c; ll ans = 1; while (b > 0) { if (b & 1)ans = ans * a%c; b >>= 1; a = a * a%c; }return ans; }
bool IsQuadraticResidue(ll a, ll p) {//判断a是否为p的二次剩余 p是素数
	return fpow(a, (p - 1) >> 1, p) == 1;
}
ll Shanks(ll a, ll p) {//求解二次同余方程x^2=a(mod p) p是素数
	if (a == 0)return 0;
	ll q = p - 1, e = 0;
	while (!(q & 1))q >>= 1, e++;
	static mt19937_64 rd(time(0));
	ll n = rd() % (p - 1) + 1;//随机选取p的一个非二次剩余，若p为定值，n也可为定值
	while (IsQuadraticResidue(n, p))n = rd() % (p - 1) + 1;
	ll z = fpow(n, q, p), y = z, r = e, x = fpow(a, (q - 1) >> 1, p), b = a * x%p*x%p;
	x = a * x%p;
	while (b != 1) {
		ll temp = b * b%p, m = 1;
		while (temp != 1)(temp *= temp) %= p, m++;
		if (m == r)return -1;
		ll t = y;
		//rep(i, 1, r - m - 1)
		for(int i=1;i<=r-m-1;i++)
			(t *= t) %= p;
		y = t * t%p, r = m % p, x = x * t%p, b = b * y%p;
	}
	return x;
}
int arr[200002];
int mn[4 * 200002];
void pushup(int rt)
{
	mn[rt] = min(mn[rson], mn[lson]);
}
void build(int l, int r, int rt)
{
	if (l == r)
	{
		mn[rt] = arr[l];
		return;
	}
	int md = mid;
	build(l, md, lson);
	build(md + 1, r, rson);
	pushup(rt);
}
int query(int L, int R, int l, int r, int rt)
{
	if (l >= L && R >= r)
	{
		return mn[rt];
	}
	int md = mid;
	int as = 1e9;
	int as1 = 1e9, as2 = 1e9;
	if (L <= md)
		as1 = query(L, R, l, md, lson);
	if (R > md)
		as2 = query(L, R, md + 1, r, rson);
	return min(as1, as2);
}
vector<int> pos[200002];

signed main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t;
	LL n, k, x, y, s, a, b;
	//int s;
	int q;
	bool flag = 1;
	cin >> n >> q;
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	int idmx = -1;
	for (int i = 1; i <= n; i++)
		if (arr[i] == q)idmx = i;
	if (idmx == -1)
		for (int i = 1; i <= n; i++)
			if (arr[i] == 0)
			{
				arr[i] = q, idmx = i;
				break;
			}
	if (arr[1] == 0)arr[1] = 1;
	if (arr[n] == 0)arr[n] = 1;
	if (idmx == -1)
	{
		cout << "NO\n";
		return 0;
	}
	for (int i = 2; i < n; i++)
		if (arr[i] == 0)
			if (arr[i + 1] == 0)
				arr[i] = arr[i - 1];
			else arr[i] = min(arr[i + 1], arr[i - 1]);
	build(1, n, 1);
	for (int i = 1; i <= n; i++)
		pos[arr[i]].push_back(i);
	for (int i = 0; i <= q; i++)
		if (pos[i].size() >= 2)
			if (query(pos[i][0], pos[i][pos[i].size() - 1], 1, n, 1) < i)
				flag = 0;
	if (flag)
	{
		cout << "YES\n";
		for (int i = 1; i <= n; i++)
			cout << arr[i] << " ";
		cout << endl;
	}
	else cout << "NO\n";
//	system("pause");
	return 0;
}