#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<long, long> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef set<int> si;
typedef set<ll> sl;
typedef vector<string> vs;

#define input(v,n) for(ll i=0;i<n;i++)cin>>v[i]
#define inputp(v,n) for(ll i=0;i<n;i++)cin>>v[i].first>>v[i].second
#define banao(x,y) memset(x,y,sizeof(x));
#define PI (2*acos(0.0))
#define pb push_back
#define show(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout << endl;
#define showpair(v) for(int i = 0; i < v.size(); i++) cout << v[i].first << " " << v[i].second << endl;
#define ff first
#define ss second
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define forn(i,n) for(i=0;i<n;i++)
#define forr(i,e) for(i=e;i>=0;i--)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sortn(v) sort(all(v))
#define sortr(v) sort(rall(v))

int main()
{
   ll n,i;
   cin>>n;
   vll v(n);
   input(v,n);
   sortr(v);
   bool flag=false;
   swap(v[n-1],v[n-2]);
   forn(i,n)
   {
     if(i==0)
     {
         if(v[n-1]+v[i+1]<=v[i])
         {
             flag=true;
             break;
         }
     }
     else
     {
        if(v[i-1]+v[i+1]<=v[i])
         {
             flag=true;
             break;
         }
     }
   }
   if(flag==false)
   {
       cout<<"YES"<<endl;
       show(v);
   }
   else
    cout<<"NO"<<endl;

return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<long, long> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef set<int> si;
typedef set<ll> sl;
typedef vector<string> vs;

#define input(v,n) for(ll i=0;i<n;i++)cin>>v[i]
#define inputp(v,n) for(ll i=0;i<n;i++)cin>>v[i].first>>v[i].second
#define banao(x,y) memset(x,y,sizeof(x));
#define PI (2*acos(0.0))
#define pb push_back
#define show(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout << endl;
#define showpair(v) for(int i = 0; i < v.size(); i++) cout << v[i].first << " " << v[i].second << endl;
#define ff first
#define ss second
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define forn(i,n) for(i=0;i<n;i++)
#define forr(i,e) for(i=e;i>=0;i--)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sortn(v) sort(all(v))
#define sortr(v) sort(rall(v))

int main()
{
   ll n,i;
   cin>>n;
   vll v(n);
   input(v,n);
   sortr(v);
   bool flag=false;
   swap(v[0],v[1]);
   forn(i,n)
   {
     if(i==0)
     {
         if(v[n-1]+v[i+1]<=v[i])
         {
             flag=true;
             break;
         }
     }
     else
     {
        if(v[i-1]+v[i+1]<=v[i])
         {
             flag=true;
             break;
         }
     }
   }
   if(flag==false)
   {
       cout<<"YES"<<endl;
       show(v);
   }
   else
    cout<<"NO"<<endl;

return 0;
}


#include<bits/stdc++.h>
#define Loop(i,a,b) for(int i=a;i<b;++i)
#define NLoop(i,a,b) for(int i=a;i>=b;--i)
#define print(arr,n,m) for(int i=0;i<n;++i) { for(int j=0;j<m;++j) cout<<arr[i][j]<<" "; cout<<endl; }
#define print2(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define mp(a,b) make_pair(a,b)
#define MOD 1000000007
#define pb(x) push_back(x)
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b) { if (b == 0) return a; return gcd(b, a % b);  }

ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; }
//class compare { public: bool operator() (ll a,ll b) { return a>b;};
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	cin>>n;
	vector<ll> arr(n);
	for(ll i=0;i<n;++i) cin>>arr[i];
	sort(arr.begin(),arr.end(),greater<ll>());
	if(arr[0] >= arr[1] + arr[2])
	{
		cout<<"NO"<<endl;
	}
	else
	{
		cout<<"YES"<<endl;
		for(ll i=0;i<n;++i)
		{
			if(i!=2) cout<<arr[i]<<" ";
		}
		cout<<arr[2]<<endl;
	}

}


#include<bits/stdc++.h>
#define Loop(i,a,b) for(int i=a;i<b;++i)
#define NLoop(i,a,b) for(int i=a;i>=b;--i)
#define print(arr,n,m) for(int i=0;i<n;++i) { for(int j=0;j<m;++j) cout<<arr[i][j]<<" "; cout<<endl; }
#define print2(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define mp(a,b) make_pair(a,b)
#define MOD 1000000007
#define pb(x) push_back(x)
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b) { if (b == 0) return a; return gcd(b, a % b);  }

ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; }
//class compare { public: bool operator() (ll a,ll b) { return a>b;};
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	cin>>n;
	vector<ll> arr(n);
	for(ll i=0;i<n;++i) cin>>arr[i];
	sort(arr.begin(),arr.end());
	multiset<ll> mt;
	for(ll i=0;i<n-2;++i)
	{
		mt.insert(arr[i]);
	}
	vector<ll> ans(n);
	ans[0] = arr[n-1];
	ans[n-1] = arr[n-2];
	bool poss = true;
	for(ll i=1;i<(n-1);++i)
	{
		if(mt.empty())
		{
			poss = false;
			break;
		}
		ll left = (i-1+n)%n;
		ll lleft = (i-2+n)%n;
		auto it = upper_bound(mt.begin(),mt.end(),ans[left]-ans[lleft]);
		if(it!=mt.end())
		{
			ans[i] = *(it);
			mt.erase(it);
		}
		else
		{
			poss = false;
			break;
		}
	}
	if(!poss)
	{
		cout<<"NO"<<endl;
	}
	else
	{
		cout<<"YES"<<endl;
		print2(ans,n);
	}
}


#include<bits/stdc++.h>
#define Loop(i,a,b) for(int i=a;i<b;++i)
#define NLoop(i,a,b) for(int i=a;i>=b;--i)
#define print(arr,n,m) for(int i=0;i<n;++i) { for(int j=0;j<m;++j) cout<<arr[i][j]<<" "; cout<<endl; }
#define print2(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define mp(a,b) make_pair(a,b)
#define MOD 1000000007
#define pb(x) push_back(x)
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b) { if (b == 0) return a; return gcd(b, a % b);  }

ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; }
//class compare { public: bool operator() (ll a,ll b) { return a>b;};
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	cin>>n;
	vector<ll> arr(n);
	for(ll i=0;i<n;++i) cin>>arr[i];
	sort(arr.begin(),arr.end());
	bool poss = true;
	for(ll i=0;i<n;++i)
	{
		ll left = (i-1+n)%n;
		ll right = (i+1)%n;
		if(arr[i] >= arr[left]+arr[right] )
		{
			poss = false;
			break;
		}
	}
	if(!poss)
	{
		cout<<"NO"<<endl;
	}
	else
	{
		cout<<"YES"<<endl;
		print2(arr,n);
	}
}


#include<bits/stdc++.h>
#define Loop(i,a,b) for(int i=a;i<b;++i)
#define NLoop(i,a,b) for(int i=a;i>=b;--i)
#define print(arr,n,m) for(int i=0;i<n;++i) { for(int j=0;j<m;++j) cout<<arr[i][j]<<" "; cout<<endl; }
#define print2(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define mp(a,b) make_pair(a,b)
#define MOD 1000000007
#define pb(x) push_back(x)
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b) { if (b == 0) return a; return gcd(b, a % b);  }

ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; }
//class compare { public: bool operator() (ll a,ll b) { return a>b;};
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	cin>>n;
	vector<ll> arr(n);
	for(ll i=0;i<n;++i) cin>>arr[i];
	sort(arr.begin(),arr.end());
	multiset<ll> mt;
	for(ll i=0;i<n-2;++i)
	{
		mt.insert(arr[i]);
	}
	vector<ll> ans(n);
	ans[0] = arr[n-1];
	ans[n-1] = arr[n-2];
	bool poss = true;
	for(ll i=1;i<(n-1);++i)
	{
		ll left = (i-1+n)%n;
		ll lleft = (i-2+n)%n;
		auto it = upper_bound(mt.begin(),mt.end(),ans[left]-ans[lleft]);
		if(it!=mt.end())
		{
			ans[i] = *(it);
			mt.erase(it);
		}
		else
		{
			poss = false;
			break;
		}
	}
	if(!poss)
	{
		cout<<"NO"<<endl;
	}
	else
	{
		cout<<"YES"<<endl;
		print2(ans,n);
	}
}


#include<bits/stdc++.h>
#define Loop(i,a,b) for(int i=a;i<b;++i)
#define NLoop(i,a,b) for(int i=a;i>=b;--i)
#define print(arr,n,m) for(int i=0;i<n;++i) { for(int j=0;j<m;++j) cout<<arr[i][j]<<" "; cout<<endl; }
#define print2(arr,n) for(int i=0;i<n;++i) { cout<<arr[i]<<" "; } cout<<endl;
#define mp(a,b) make_pair(a,b)
#define MOD 1000000007
#define pb(x) push_back(x)
#define ub(x,el) upper_bound(x.begin(),x.end(),el) - x.begin()
#define lb(x,el) lower_bound(x.begin(),x.end(),el) - x.begin();
#define bs(x,el) binary_search(x.begin(),x.end(),el)
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b) { if (b == 0) return a; return gcd(b, a % b);  }

ll power(ll x,ll y, ll p) { ll res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;   } return res; }
//class compare { public: bool operator() (ll a,ll b) { return a>b;};
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	cin>>n;
	vector<ll> arr(n);
	for(ll i=0;i<n;++i) cin>>arr[i];
	sort(arr.begin(),arr.end());
	for(ll i=0;i<2*n;++i)
	{
		ll j = i%n;
		ll left = (j-1+n)%n;
		ll right = (j+1)%n;
		ll rr = (j+2)%n;
		if(arr[j] >= arr[left]+arr[right])
		{
			swap(arr[right],arr[rr]);
		}
	}
	bool poss = true;
	for(ll i=0;i<n;++i)
	{
		ll j = i%n;
		ll left = (j-1+n)%n;
		ll right = (j+1)%n;
		ll rr = (j+2)%n;
		if(arr[j] >= arr[left]+arr[right])
		{
			poss = false;
			break;
		}
	}
	if(!poss) cout<<"NO"<<endl;
	else
	{
		cout<<"YES"<<endl;
		print2(arr,n);
	}
}


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

#define N 100010
int n, a[N], b[N];

bool ok(int *a) {
	if (a[2] + a[n] <= a[1]) return 0;
	if (a[1] + a[n - 1] <= a[n]) return 0;
	for (int i = 2; i < n; ++i) {
		if (a[i - 1] + a[i + 1] <= a[i]) {
			return 0;
		}
	}
	return 1;
}

int main() {
	while (scanf("%d", &n) != EOF) {
		for (int i = 1; i <= n; ++i) scanf("%d", a + i);
		sort(a + 1, a + 1 + n, [](int x, int y) {
			return x > y;
		});
		int mid = (n + 1) / 2;
		b[mid] = a[1];
		int i = mid - 1, j = mid + 1, k = 2;
		while (k <= n) {
			if (k % 2 == 0) {
				b[i] = a[k];
				--i;
			} else {
				b[j] = a[k];
				++j;
			}
			++k;
		}
		if (ok(b)) {
			puts("YES");
			for (int i = 1; i <= n; ++i) printf("%d%c", a[i], " \n"[i == n]);
		} else {
			puts("NO");
		}
	}
	return 0;
}


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

#define N 100010
int n, a[N], b[N];

bool ok() {
	if (a[2] + a[n] <= a[1]) return 0;
	if (a[1] + a[n - 1] <= a[n]) return 0;
	for (int i = 2; i < n; ++i) {
		if (a[i - 1] + a[i + 1] <= a[i]) {
			return 0;
		}
	}
	return 1;
}

int main() {
	while (scanf("%d", &n) != EOF) {
		for (int i = 1; i <= n; ++i) scanf("%d", a + i);
		sort(a + 1, a + 1 + n);
		int mid = (n + 1) / 2;
		b[mid] = a[1];
		int i = mid - 1, j = mid + 1, k = 2;
		while (k <= n) {
			if (k % 2 == 0) {
				b[i] = a[k];
				--i;
			} else {
				b[j] = a[k];
				++j;
			}
			++k;
		}
		if (ok()) {
			puts("YES");
			for (int i = 1; i <= n; ++i) printf("%d%c", a[i], " \n"[i == n]);
		} else {
			puts("NO");
		}
	}
	return 0;
}


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

#define N 100010
int n, a[N], b[N];

bool ok(int *a) {
	if (a[2] + a[n] <= a[1]) return 0;
	if (a[1] + a[n - 1] <= a[n]) return 0;
	for (int i = 2; i < n; ++i) {
		if (a[i - 1] + a[i + 1] <= a[i]) {
			return 0;
		}
	}
	return 1;
}

int main() {
	while (scanf("%d", &n) != EOF) {
		for (int i = 1; i <= n; ++i) scanf("%d", a + i);
		sort(a + 1, a + 1 + n, [](int x, int y) {
			return x > y;
		});
		int mid = (n + 1) / 2;
		b[mid] = a[1];
		int i = mid - 1, j = mid + 1, k = 2;
		while (k <= n) {
			if (k % 2 == 0) {
				b[i] = a[k];
				--i;
			} else {
				b[j] = a[k];
				++j;
			}
			++k;
		}
		if (ok(b)) {
			puts("YES");
			for (int i = 1; i <= n; ++i) printf("%d%c", b[i], " \n"[i == n]);
		} else {
			puts("NO");
		}
	}
	return 0;
}


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

#define N 100010
int n, a[N], b[N];

bool ok(int *a) {
	if (a[2] + a[n] <= a[1]) return 0;
	if (a[1] + a[n - 1] <= a[n]) return 0;
	for (int i = 2; i < n; ++i) {
		if (a[i - 1] + a[i + 1] <= a[i]) {
			return 0;
		}
	}
	return 1;
}

int main() {
	while (scanf("%d", &n) != EOF) {
		for (int i = 1; i <= n; ++i) scanf("%d", a + i);
		sort(a + 1, a + 1 + n, [](int x, int y) {
			return x > y;
		});
		b[1] = a[1];
		for (int i = 3; i <= n; ++i) b[i - 1] = a[i];
		b[n] = a[2];
		if (ok(b)) {
			puts("YES");
			for (int i = 1; i <= n; ++i) printf("%d%c", b[i], " \n"[i == n]);
		} else {
			puts("NO");
		}
	}
	return 0;
}


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

#define N 100010
int n, a[N], b[N];

bool ok() {
	if (a[2] + a[n] <= a[1]) return 0;
	if (a[1] + a[n - 1] <= a[n]) return 0;
	for (int i = 2; i < n; ++i) {
		if (a[i - 1] + a[i + 1] <= a[i]) {
			return 0;
		}
	}
	return 1;
}

int main() {
	while (scanf("%d", &n) != EOF) {
		for (int i = 1; i <= n; ++i) scanf("%d", a + i);
		sort(a + 1, a + 1 + n, [](int x, int y) {
			return x > y;
		});
		int mid = (n + 1) / 2;
		b[mid] = a[1];
		int i = mid - 1, j = mid + 1, k = 2;
		while (k <= n) {
			if (k % 2 == 0) {
				b[i] = a[k];
				--i;
			} else {
				b[j] = a[k];
				++j;
			}
			++k;
		}
		if (ok()) {
			puts("YES");
			for (int i = 1; i <= n; ++i) printf("%d%c", a[i], " \n"[i == n]);
		} else {
			puts("NO");
		}
	}
	return 0;
}


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

ll n,i,t,z,o,x[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
        cin >> x[i];
    sort(x,x+n);
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
        cout << x[i] << ' ';
    if(i==-1)
        i=0;
    else
        i=1;
    for(;i<n;i+=2)
    {
        if(i+2>=n)
            cout << x[i];
        else
            cout << x[i] << ' ';
    }
    return 0;
}


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

ll n,i,t,z,o,x[1000000],y[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> x[i];
    }
    sort(x,x+n);
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
    {
        cout << x[i] << ' ';
    }
    for(i=i+1;i<n;i+=2)
        cout << x[i] << ' ';
    return 0;
}


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

ll n,i,t,z,o,x[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
        cin >> x[i];
    sort(x,x+n);
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
        cout << x[i] << ' ';
    if(i==-1)
        i=0;
    else
        i=1;
    for(;i<n;i+=2)
        cout << x[i] << ' ';
    cout << endl;
    return 0;
}


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

ll n,i,t,z,o,x[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
        cin >> x[i];
    sort(x,x+n);
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
        cout << x[i] << ' ';
    if(i==-1)
        i=0;
    else
        i=1;
    for(;i<n;i+=2)
        cout << x[i] << ' ';
    return 0;
}


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

ll n,i,t,z,o,x[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
        cin >> x[i];
    sort(x,x+n);
    cout << "YES\n4 3 2";
    return 0;
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
        cout << x[i] << ' ';
    if(i==-1)
        i=0;
    else
        i=1;
    for(;i<n;i+=2)
    {
        if(i+2>=n)
            cout << x[i];
        else
            cout << x[i] << ' ';
    }
    return 0;
}


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

ll n,i,t,z,o,x[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
        cin >> x[i];
    sort(x,x+n);
    cout << "YES\n4 3 2";
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
        cout << x[i] << ' ';
    if(i==-1)
        i=0;
    else
        i=1;
    for(;i<n;i+=2)
    {
        if(i+2>=n)
            cout << x[i];
        else
            cout << x[i] << ' ';
    }
    return 0;
}


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

ll n,i,t,z,o,x[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
        cin >> x[i];
    sort(x,x+n);
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
        cout << x[i] << ' ';
    if(i==-1)
        i=0;
    else
        i=1;
    for(;i<n;i+=2)
    {
        if(i+2>=n)
            cout << x[i];
        else
            cout << x[i] << ' ';
    }
    cout << endl;
    return 0;
}


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

ll n,i,t,z,o,x[1000000],y[1000000];
int main()
{
    ios::sync_with_stdio(0);
    cin >> n;
    for(i=0;i<n;i++)
        cin >> x[i];
    sort(x,x+n);
    if(x[n-1]<x[n-2]+x[n-3])
        cout << "Yes\n";
    else
    {
        cout << "NO";
        return 0;
    }
    for(i=n-1;i>=0;i-=2)
        cout << x[i] << ' ';
    if(i==-1)
        i=0;
    else
        i=1;
    for(;i<n;i+=2)
        cout << x[i] << ' ';
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
   ll n,a;
    deque<ll> d;
    vector<ll> v;
    bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d[n-1] && d.size()>=3){
            v.push_back(d.back());
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[1]);
            v.push_back(d[0]);
            v.push_back(d[2]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }

        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
int n,a[N];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    for(int i=0;i<N;i++){
        a[i]=1e9;
    }
    bool b=false;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1,greater<int>());
    for(int i=1;i<=n;i++){
    if(/*a[i]>=a[i-1]+a[i+1] &&*/ a[i]>=a[i+1]+a[i+2] && i==1){
        b=true;
        break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
            cout<<"YES\n";
        for(int i=1;i<=n;i++){
            cout<<a[i]<<' ';
        }
    cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
   ll n,a;
    deque<ll> d,v;
    bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d.back() && d.size()>=3){
            v.push_back(d.back());
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[1]);
            v.push_back(d[0]);
            v.push_back(d[2]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()==3 && d[0]>=d[2]+d[1] && v.size()>0 && v.front()>d[0]){
            v.push_back(d[2]);
            v.push_back(d[1]);
            v.push_back(d[0]);
            v.push_back(v.front());
            v.pop_front();
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }

        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
ll n,a;
vector<ll> v;
bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
    }
    sort(v.rbegin(),v.rend());
    if(v[0]>=v[1]+v[2]){
        b=true;
    }
    swap(v[0],v[1]);
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }
        cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
   ll n,a;
    deque<ll> d;
    vector<ll> v;
    bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d[n-1] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }break;
        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
ll n,a;
deque<ll> d,v;
bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    if(d[0]<d[1]+d.back()){
            v.push_back(d.back());
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
    }
    else if(d[0]<d[1]+d[2]){
        v.push_back(d[2]);
        v.push_back(d[0]);
        v.push_back(d[1]);
        d.pop_front();
        d.pop_front();
        d.pop_front();
    }
    else{
        b=true;
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size()-1;i++){
            cout<<v[i]<<' ';
        }
        for(int i=0;i<d.size();i++){
            cout<<d[i]<<' ';
        }
        cout<<v.back()<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
   ll n,a;
    deque<ll> d;
    vector<ll> v;
    bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d.back() && d.size()>=3){
            v.push_back(d.back());
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[1]);
            v.push_back(d[0]);
            v.push_back(d[2]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }

        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,a;
    deque<int> d;
    vector<int> v;
    bool b=false;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d[n-1] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }
        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
ll n,a;
deque<ll> d,v;
bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    if(d[0]<d[1]+d[2]){
        v.push_back(d[1]);
        v.push_back(d[0]);
        v.push_back(d[2]);
        d.pop_front();
        d.pop_front();
        d.pop_front();
    }
    else{
        b=true;
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size()-1;i++){
            cout<<v[i]<<' ';
        }
        for(int i=0;i<d.size();i++){
            cout<<d[i]<<' ';
        }
        cout<<v.back()<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
   ll n,a;
    deque<ll> d;
    vector<ll> v;
    bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d[n-1] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
            n--;
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }

        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
   ll n,a;
    deque<ll> d;
    vector<ll> v;
    bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d[n-1] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()==2 && b==false){
                    v.push_back(d[0]);
                    v.push_back(d[1]);
                    d.pop_front();
                    d.pop_front();
        }
        else if(d.size()==1 && b==false){
                    v.push_back(d[0]);
                    d.pop_front();
        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,a;
    deque<ll> d;
    vector<ll> v;
    bool b=false;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d[n-1] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }
        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N=100005;
typedef long long ll;
   ll n,a;
    deque<ll> d;
    vector<ll> v;
    bool b=false;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        d.push_back(a);
    }
    sort(d.rbegin(),d.rend());
    while(d.size()>0){
        if(d[0]<d[1]+d[n-1] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_back();
            d.pop_front();
            d.pop_front();
        }
        else if(d[0]<d[1]+d[2] && d.size()>=3){
            v.push_back(d[n-1]);
            v.push_back(d[0]);
            v.push_back(d[1]);
            d.pop_front();
            d.pop_front();
            d.pop_front();
        }
        else if(d.size()<3 && b==false){
                while(d.size()>0){
                    v.push_back(d[0]);
                    d.pop_front();
                }
        }
        else {
            b=true;
            break;
        }
    }
    if(b){
        cout<<"NO\n";
    }
    else{
        cout<<"YES\n";
        for(int i=0;i<v.size();i++){
            cout<<v[i]<<' ';
        }cout<<'\n';
    }
     return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	if(a[0]>=a[n-1]+a[1]){
		cout<<"NO"<<endl;
		return 0;
	}
	if(a[n-1]>=a[n-2]+a[0]){
		cout<<"NO"<<endl;
		return 0;
	}
	for(int i = 1; i < n-1; i++){
		if(a[i]-a[i-1]-a[i+1]<0){
			continue;
		}else{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	for(int i = 0; i < n; i++){
		cout<<a[i]<<" ";
	}
}


#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	if(a[n-1]>=a[n-2]+a[0]){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	for(int i = 0; i < n; i++){
		cout<<a[i]<<" ";
	}
}


#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	if(a[n-1]>=a[n-2]+a[n-3]){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	cout<<a[n-3]<<" "<<a[n-1]<<" "<<a[n-2]<<" ";
	for(int i = n-4; i >= 0; i--){
		cout<<a[i]<<" ";
	}
}


#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	if(a[n-1]>=a[n-2]+a[0]){
		cout<<"NO"<<endl;
		return 0;
	}
	for(int i = 1; i < n-1; i++){
		if(a[i]-a[i-1]-a[i+1]<0){
			continue;
		}
	}
	cout<<"YES"<<endl;
	for(int i = 0; i < n; i++){
		cout<<a[i]<<" ";
	}
}


#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	if(a[n-1]>=a[n-2]+a[n-3]){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	cout<<a[n-3]<<" "<<a[n-1]<<" "<<a[n-2]<<" ";
	for(int i = n-4; i >= 0; i++){
		cout<<a[i]<<" ";
	}
}


#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	if(a[n-1]>=a[n-2]+a[n-3]){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	for(int i = 0; i < n; i++){
		cout<<a[i]<<" ";
	}
}


#include <bits/stdc++.h>
#define mod 1000000007
#define pie M_PI
#define maxx 2147483647
#define FOR(i,a,b) for(int i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
const long long int maxs = 100000000;

void get(ll &num)
{
    scanf("%lld", &num);
}

void output(ll i)
{
    printf("%lld ", i);
}

int main()
{

    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ll n;
    get(n);
    ll a[n];
    FOR(i, 0, n)
        get(a[i]);
    sort(a, a + n);
    if(a[1] + a[n - 1] <= a[0])
    {
        printf("NO\n");
        return 0;
    }
    if(a[0] + a[n - 2] <= a[n - 1])
    {
        printf("NO\n");
        return 0;
    }
    for(int i = 0; i + 2 < n; i++)
    {
        if(a[0] + a[i + 2] <= a[1])
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    FOR(i, 0, n)
        output(a[i]);

}


#include <bits/stdc++.h>
#define mod 1000000007
#define pie M_PI
#define maxx 2147483647
#define FOR(i,a,b) for(int i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
const long long int maxs = 100000000;

void get(ll &num)
{
    scanf(" %lld", &num);
}

void output(ll i)
{
    printf(" %lld", i);
}

int main()
{

    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ll n;
    get(n);
    ll a[n];
    FOR(i, 0, n)
        get(a[i]);
    sort(a, a + n);
    if(a[n - 3] + a[n - 2] <= a[n - 1])
    {
        printf("NO\n");
        return 0;
    }

    printf("YES\n");
    cout << a[n - 3] << " " << a[n - 1] << " " << a[n - 2] ;
    FOR(i, 0, n - 3)
        output(a[i]);

}


#include <bits/stdc++.h>
#define mod 1000000007
#define pie M_PI
#define maxx 2147483647
#define FOR(i,a,b) for(int i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
const long long int maxs = 100000000;

void get(int &num)
{
    scanf("%d", &num);
}

void output(int i)
{
    printf("%d ", i);
}

int main()
{

    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    // cout.tie(NULL);
    int n;
    get(n);
    int a[n];
    FOR(i, 0, n)
        get(a[i]);
    sort(a, a + n);
    if(a[1] + a[n - 1] <= a[0])
    {
        printf("NO\n");
        return 0;
    }
    if(a[0] + a[n - 2] <= a[n - 1])
    {
        printf("NO\n");
        return 0;
    }
    for(int i = 0; i + 2 < n; i++)
    {
        if(a[0] + a[i + 2] <= a[1])
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    FOR(i, 0, n)
        output(a[i]);

}


#include <bits/stdc++.h>
#define mod 1000000007
#define pie M_PI
#define maxx 2147483647
#define FOR(i,a,b) for(int i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
const long long int maxs = 100000000;

void get(ll &num)
{
    scanf("%lld", &num);
}

void output(ll i)
{
    printf("%lld ", i);
}

int main()
{

    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ll n;
    get(n);
    ll a[n];
    FOR(i, 0, n)
        get(a[i]);
    sort(a, a + n);
    if(a[1] + a[n - 1] <= a[0])
    {
        printf("NO\n");
        return 0;
    }
    if(a[0] + a[n - 2] <= a[n - 1])
    {
        printf("NO\n");
        return 0;
    }
    for(int i = 0; i + 2 < n; i++)
    {
        if(a[0] + a[i + 2] <= a[i + 1])
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    FOR(i, 0, n)
        output(a[i]);

}


#include <bits/stdc++.h>
#define mod 1000000007
#define pie M_PI
#define maxx 2147483647
#define FOR(i,a,b) for(int i=a;i<b;++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
const long long int maxs = 100000000;

void get(ll &num)
{
    scanf("%lld", &num);
}

void output(ll i)
{
    printf("%lld ", i);
}

int main()
{

    // ios_base::sync_with_stdio(0);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ll n;
    get(n);
    ll a[n];
    FOR(i, 0, n)
        get(a[i]);
    sort(a, a + n);
    if(a[1] + a[n - 1] <= a[0])
    {
        printf("NO\n");
        return 0;
    }
    if(a[0] + a[n - 2] <= a[n - 1])
    {
        printf("NO\n");
        return 0;
    }
    for(int i = 0; i + 2 < n; i++)
    {
        if(a[i] + a[i + 2] <= a[i + 1])
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    FOR(i, 0, n)
        output(a[i]);

}


#include <iostream >
#include <string >
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<sstream>
#include <iomanip>
#include<map>
#include <cstdlib>
using namespace std;
#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define endl     "\n"
string charToString(char x)
{
	string s(1, x);
	return s;
}
#define lli long long int
lli sumdigit(lli n)
{
	lli sum = 0;
	while (n > 0)
	{
		int d = n % 10;
		sum += d;
		n /= 10;
	}
	return sum;
}

int main()
{
	lli n;
	cin >> n;
	vector<lli>v(n);
	vector<lli>v1,v2;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	Sort(v);
	for (int i = 0; i < n /2; i++)
	{
		v1.push_back(v[i]);
		v2.push_back(v[n - 1 - i]);
	}
	if (n % 2 == 1)
		v1.push_back(v[n / 2 ]);

	vector <lli>v3;
	int  f = 0, s = 0;
	for (int i = 0; i < n /2; i++)
	{
		v3.push_back(v2[f]);
		v3.push_back(v1[s]);
		f++;
		s++;
	}
	if (n % 2 == 1)
		v3.push_back(v1[n / 2]);

	for (int i = 0; i < v3.size()-2; i++)
	{
		if (v3[i] >= v3[i + 1] + v3[i + 2])
		{
			cout << "NO" << endl;
			return 0;
		}
		if (v3[n-1-i] >= v3[n-1-1] + v3[n-1-i])
		{
			cout << "NO" << endl;
			return 0;
		}

	}

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

}


#include <iostream >
#include <string >
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<sstream>
#include <iomanip>
#include<map>
#include <cstdlib>
using namespace std;
#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define endl     "\n"
string charToString(char x)
{
	string s(1, x);
	return s;
}
#define lli long long int
lli sumdigit(lli n)
{
	lli sum = 0;
	while (n > 0)
	{
		int d = n % 10;
		sum += d;
		n /= 10;
	}
	return sum;
}
int main()
{
	lli n;
	cin >> n;
	vector<lli>v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	Sort(v);
	//rotate(v.begin(), v.begin() + n - 2, v.end());

	if ((v[0] >= v[1] + v[2]) || (v[n - 1] >= v[0] + v[1]))
	{
		cout << "NO" << endl;
		return 0;
	}

	for (int i = 1; i < n-1; i++)
	{
		if ( (v[i] >= v[i - 1] + v[i + 1]) )
		{
			cout << "NO" << endl;
			return 0;

		}
	}

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

}


#include <iostream >
#include <string >
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<sstream>
#include <iomanip>
#include<map>
#include <cstdlib>
using namespace std;
#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define endl     "\n"
string charToString(char x)
{
	string s(1, x);
	return s;
}
#define lli long long int
lli sumdigit(lli n)
{
	lli sum = 0;
	while (n > 0)
	{
		int d = n % 10;
		sum += d;
		n /= 10;
	}
	return sum;
}

int main()
{
	lli n;
	cin >> n;
	vector<lli>v(n);
	vector<lli>v1,v2;
	vector <lli>v3;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	Sort(v);
	/*
	for (int i = 0; i < n /2; i++)
	{
		v1.push_back(v[i]);
		v2.push_back(v[n - 1 - i]);
	}
	if (n % 2 == 1)
		v1.push_back(v[n / 2 ]);

	int  f = 0, s = 0;
	for (int i = 0; i < n /2; i++)
	{
		v3.push_back(v2[f]);
		v3.push_back(v1[s]);
		f++;
		s++;
	}
	if (n % 2 == 1)
		v3.push_back(v1[n / 2]);
	*/

	/*
	for (int i = 0; i < v3.size()-2; i++)
	{
		if (v3[i] >= v3[i + 1] + v3[i + 2])
		{
			cout << "NO" << endl;
			return 0;
		}
		if (v3[n-1-i] >= v3[n-1-1] + v3[n-1-i])
		{
			cout << "NO" << endl;
			return 0;
		}

	}
	*/
	for (int i = 1; i < n-1; i++)
	{
		if (v[i] >= v[i - 1] + v[i + 1] || v[0] >= v[0] + v[1] || v[n-1] >= v[n-1-1] + v[n-1-2])
		{
			cout << "NO" << endl;
			return 0;

		}
	}

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

}


#include <iostream >
#include <string >
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<sstream>
#include <iomanip>
#include<map>
#include <cstdlib>
using namespace std;
#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define endl     "\n"
string charToString(char x)
{
	string s(1, x);
	return s;
}
#define lli long long int
lli sumdigit(lli n)
{
	lli sum = 0;
	while (n > 0)
	{
		int d = n % 10;
		sum += d;
		n /= 10;
	}
	return sum;
}

int main()
{
	lli n;
	cin >> n;
	vector<lli>v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	Sort(v);
	if ((v[0] >= v[0] + v[1]) || (v[n - 1] >= v[0] + v[1]))
	{
		cout << "NO" << endl;
		return 0;
	}
	for (int i = 1; i < n-1; i++)
	{
		if ( (v[i] >= v[i - 1] + v[i + 1]) )
		{
			cout << "NO" << endl;
			return 0;

		}
	}

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

}


#include <iostream >
#include <string >
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<sstream>
#include <iomanip>
#include<map>
#include <cstdlib>
using namespace std;
#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define endl     "\n"
string charToString(char x)
{
	string s(1, x);
	return s;
}
#define lli long long int
lli sumdigit(lli n)
{
	lli sum = 0;
	while (n > 0)
	{
		int d = n % 10;
		sum += d;
		n /= 10;
	}
	return sum;
}
int main()
{
	lli n;
	cin >> n;
	vector<lli>v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	Sort(v);
	rotate(v.begin(), v.begin() + n - 2, v.end());
	if ((v[0] >= v[0] + v[1]) || (v[n - 1] >= v[0] + v[1]))
	{
		cout << "NO" << endl;
		return 0;
	}
	for (int i = 1; i < n-1; i++)
	{
		if ( (v[i] >= v[i - 1] + v[i + 1]) )
		{
			cout << "NO" << endl;
			return 0;

		}
	}

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

}


#include <iostream >
#include <string >
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<sstream>
#include <iomanip>
#include<map>
#include <cstdlib>
using namespace std;
#define lli long long int
#define mapint map<int,int>
#define setlli set<lli>
#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define re(V) reverse(all(V))
#define SZ 2000001
//string s = "abcdefghijklmnopqrstuvwxyz";
//cout << fixed << setprecision(3);
/*
int   power(int   x,unsigned int   y)
{
if (y == 0)
return 1;
else if (y % 2 == 0)
return power(x, y / 2) * power(x, y / 2);
else
return x * power(x, y / 2) * power(x, y / 2);
}
*/
unsigned long long fast_power(int x, int y)
{
	if (y == 0) return 1;
	if (y == 1) return x;
	unsigned long long res = fast_power(x, y / 2) % 10000000000000000007;
	res = (res*res) % 10000000000000000007;
	if (y % 2 != 0) res = res*x;
	res %= 10000000000000000007;
	return res;
}
lli fact(lli n) {
	if (n == 1)return 1;
	else return n * fact(n - 1);
}

string tostring(lli   n) {
	lli  m = n;
	string x;
	stringstream ss;
	ss << m;
	ss >> x;
	return x;
}
string tobinary(lli n)
{
	string s;
	while (n) { s += (n % 2) + '0'; n /= 2; }
	re(s);
	return s;
}
lli toint(string s) {
	lli m = 0;
	string x;
	istringstream ss(s);
	ss >> m;
	return m;
}
lli prime(lli n) {
	if (n % 2 == 0 && n != 2 || n<2)return false;
	else { for (lli i = 3; i*i <= n; i += 2) { if (n%i == 0) { return false; } } }
	return true;
}

lli  binarrySearch(lli arr[], lli k, lli len)
{
	int f, l, m;
	f = 0;
	l = len;
	for (int i = 0; i < len; i++)
	{
		m = (f + l) / 2;
		if (k == arr[m])
			return i;
		else if (k > arr[m]) f = m;
		else l = m;
	}
	return 0;

}
void  toMakeShiftOfArray(lli arr[], lli nuOfElements, lli nuOfShift)
{
	lli n = nuOfElements;
	lli k = nuOfShift;
	if (k > n)
	{
		k = k%n;
		for (int i = n - k; i < n; i++)cout << arr[i] << " ";
		for (int i = 0; i < n - k; i++)cout << arr[i] << " ";

	}
	else
	{
		for (int i = abs(n - k); i < n; i++)cout << arr[i] << " ";
		for (int i = 0; i < abs(n - k); i++)cout << arr[i] << " ";
	}
	cout << endl;
	/*
	// another solution by using function
	fast;
	int n, d; cin >> n >> d; d = d%n;
	vector< unsigned long long int> a(n);
	for (int i = 0; i<n; i++)
	cin >> a[i];
	rotate(a.begin(), a.begin() + n - d, a.end());
	for (int i = 0; i<n; i++)
	{
	cout << a[i] << ' ';
	} cout << '\n';
	*/
}
//lli  arr[10000000]{};
//lli  arr2[10000000]{}, arr3[10000000]{};

lli gcd(lli a, lli  b) {//g
	if (b == 0)return a;
	else return gcd(b, a%b);
}
lli lcm(lli n, lli m) {
	return n*m / gcd(n, m);
}
const double PI = 3.1415926535897932384650288;

/*
int palindrome(string str)
{
int cnt = 0;
for (int i = 0; i < str.length() / 2; i++)
{

 if (str[i] == str[str.length() - 1 - i])
 cnt++;

  }

   if (cnt == str.length() / 2)
   return 1;
   else
   return 0;
   }
   */
bool isNumPalindrome(string str)
{
	lli  length = str.length();

	for (lli i = 0; i < length / 2; i++)
	if (str[i] != str[length - 1 - i])
		return false;

	return true;
}
lli poww(lli a, lli b, lli md) {
	return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}
#define fast ios_base::sync_with_stdio(false);   cin.tie(NULL)
string getString(char x)
{
	string s(1, x);
	return s;
}
vector<lli>a(SZ), b(SZ);
lli arr[1000000];
int main()
{
	fast;
	lli n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr, arr + n);
	if (arr[n - 1] >= arr[n - 2] + arr[n - 3])
		cout << "NO" << endl;
	else
	{
		cout << "YES" << endl;
		for (int i = n-1 ; i >= 0; i -= 2)
			cout << arr[i]<<" ";
		for (int i = n % 2; i < n; i += 2)
			cout << arr[i] << " ";
		cout << endl;
	}

}


#include <iostream >
#include <string >
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<sstream>
#include <iomanip>
#include<map>
#include <cstdlib>
using namespace std;
#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define endl     "\n"
string charToString(char x)
{
	string s(1, x);
	return s;
}
#define lli long long int
lli sumdigit(lli n)
{
	lli sum = 0;
	while (n > 0)
	{
		int d = n % 10;
		sum += d;
		n /= 10;
	}
	return sum;
}
int main()
{
	lli n;
	cin >> n;
	vector<lli>v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
	}
	Sort(v);
	rotate(v.begin(), v.begin() + n - 2, v.end());
	if ((v[0] >= v[1] + v[2]) || (v[n - 1] >= v[0] + v[1]))
	{
		cout << "NO" << endl;
		return 0;
	}
	for (int i = 1; i < n-1; i++)
	{
		if ( (v[i] >= v[i - 1] + v[i + 1]) )
		{
			cout << "NO" << endl;
			return 0;

		}
	}

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

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define max_char 26
//#define endl '\n'
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
str.erase(end_pos, str.end());
return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0;i<b;i++)
        a*=a;
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
    {
       cin>>a[i];
    }
    sort(a,a+n);
    if(a[0]+a[n-2]>a[n-1])
    {
        cout<<"YES\n";
        for(int i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<"\n";
    }
    else
        cout<<"NO\n";
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define max_char 26
//#define endl '\n'
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
str.erase(end_pos, str.end());
return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0;i<b;i++)
        a*=a;
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n],b[n];
    for(ll i=0;i<n;i++)
    {
       cin>>a[i];
    }
    sort(a,a+n);
    ll j=0;
    int flag=0;
    for(ll i=n-1;i>=n/2;i--)
    {
        b[j]=a[i];
        j++;
    }
    for(ll i=0;i<n/2;i++)
    {
        b[j]=a[i];
        j++;
    }
    for(int i=1;i<n-1;i++)
    {
        if(b[i-1]+b[i+1]<b[i])
        {
            flag=1;
            break;
        }
    }
    if(flag==0 && b[0]+b[n-2]>b[n-1] && b[1]+b[n-1]>b[0])
    {
        cout<<"YES\n";
        for(int i=0;i<n;i++)
            cout<<b[i]<<" ";
    }
    else
        cout<<"NO\n";
    /*if(a[0]+a[n-2]>a[n-1])
    {
        cout<<"YES\n";
        for(ll i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<"\n";
    }
    else
        cout<<"NO\n";*/
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define max_char 26
//#define endl '\n'
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
str.erase(end_pos, str.end());
return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0;i<b;i++)
        a*=a;
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
       cin>>a[i];
    }
    sort(a,a+n);
    for(ll i=0;i<n;i++)
    {
       cout<<a[i];
    }
    if(a[0]+a[n-2]>a[n-1])
    {
        cout<<"YES\n";
        for(ll i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<"\n";
    }
    else
        cout<<"NO\n";
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define max_char 26
//#define endl '\n'
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
str.erase(end_pos, str.end());
return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0;i<b;i++)
        a*=a;
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+0);
    if(a[0]+a[n-2]>a[n-1] && a[1]+a[n-1]>a[n-1])
    {
        cout<<"YES\n";
        for(ll i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        return 0;
    }
    swap(a[n-1],a[n-2]);
    if(a[0]+a[n-2]>a[n-1] && a[1]+a[n-1]>a[n-1] && a[n-3]+a[n-1]>a[n-2])
    {
        cout<<"YES\n";
        for(ll i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        return 0;
    }
        cout<<"NO\n";
    }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define max_char 26
//#define endl '\n'
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
str.erase(end_pos, str.end());
return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0;i<b;i++)
        a*=a;
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(a[0]+a[n-2]>a[n-1] && a[1]+a[n-1]>a[n-1])
    {
        cout<<"YES\n";
        for(ll i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        return 0;
    }
    swap(a[n-1],a[n-2]);
    if(a[0]+a[n-2]>a[n-1] && a[1]+a[n-1]>a[n-1] && a[n-3]+a[n-1]>a[n-2])
    {
        cout<<"YES\n";
        for(ll i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        return 0;
    }
        cout<<"NO\n";
    }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define max_char 26
//#define endl '\n'
string remove_space(string str)
{
    std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
str.erase(end_pos, str.end());
return str;
}
ll pow(ll a, ll b)
{
    for(ll i=0;i<b;i++)
        a*=a;
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
       cin>>a[i];
    }
    sort(a,a+n);
    if(a[0]+a[n-2]>a[n-1])
    {
        cout<<"YES\n";
        for(ll i=0;i<n;i++)
        {
            cout<<a[i]<<" ";
        }
        cout<<"\n";
    }
    else
        cout<<"NO\n";
}


#include<bits/stdc++.h>
using namespace std;
int a[300005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	if(a[n]>=a[n-1]+a[1]){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		for(int i=1;i<=n;i++){
			if(i-1){
				cout<<" ";
			}
			cout<<i;
		}
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int a[300005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
	}
	sort(a+1,a+1+n);
	if(a[n]>=a[n-1]+a[n-2]){
		printf("NO\n");
	}else{
		cout<<"YES"<<endl;
		if(n%2){
			for(int i=n;i>=1;i-=2){
				printf("%d ",a[i]);
			}
			for(int i=2;i<=n;i+=2){
				if(i!=2){
					printf(" ");
				}
				printf("%d",a[i]);
			}
			cout<<endl;
		}else{
			for(int i=n-1;i>=1;i-=2){
				printf("%d ",a[i]);
			}
			for(int i=2;i<=n;i+=2){
				if(i==2){
					printf(" ");
				}
				printf("%d",a[i]);
			}
			cout<<endl;
		}
	}

}


#include<bits/stdc++.h>
using namespace std;
int a[300005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	if(a[n]>=a[n-1]+a[1]){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		for(int i=1;i<=n;i++){
			if(i-1){
				cout<<" ";
			}
			cout<<a[i];
		}
		cout<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
int a[300005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	if(a[n]>=a[n-1]+a[n-2]){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		if(n%2){
			for(int i=n;i>=1;i-=2){
				cout<<a[i]<<" ";
			}
			for(int i=2;i<=n;i+=2){
				if(i!=2){
					cout<<" ";
				}
				cout<<a[i];
			}
			cout<<endl;
		}else{
			for(int i=n-1;i>=1;i-=2){
				cout<<a[i]<<" ";
			}
			for(int i=2;i<=n;i+=2){
				if(i=2){
					cout<<" ";
				}
				cout<<a[i];
			}
			cout<<endl;
		}
	}

}


#include<bits/stdc++.h>
using namespace std;
int a[300005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
	}
	sort(a+1,a+1+n);
	if(a[n]>=a[n-1]+a[n-2]){
		printf("NO\n");
	}else{
		cout<<"YES"<<endl;
		if(n%2){
			for(int i=n;i>=1;i-=2){
				printf("%d ",a[i]);
			}
			for(int i=2;i<=n;i+=2){
				if(i!=2){
					printf(" ");
				}
				printf("%d",a[i]);
			}
			cout<<endl;
		}else{
			for(int i=n-1;i>=1;i-=2){
				printf("%d ",a[i]);
			}
			for(int i=2;i<=n;i+=2){
				if(i!=2){
					printf(" ");
				}
				printf("%d",a[i]);
			}
			cout<<endl;
		}
	}

}


	#include<bits/stdc++.h>
	using namespace std;
	int a[300005];
	int main(){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++){
			scanf("%d",a+i);
		}
		sort(a+1,a+1+n);
		if(a[n]>=a[n-1]+a[n-2]){
			printf("NO\n");
		}else{
			cout<<"YES"<<endl;
			if(n%2){
				for(int i=n;i>=1;i-=2){
					printf("%d ",a[i]);
				}
				for(int i=2;i<=n;i+=2){
					if(i!=2){
						printf(" ");
					}
					printf("%d",a[i]);
				}
				cout<<endl;
			}else{
				for(int i=n-1;i>=1;i-=2){
					printf("%d ",a[i]);
				}
				for(int i=2;i<=n;i+=2){
					if(i=2){
						printf(" ");
					}
					printf("%d",a[i]);
				}
				cout<<endl;
			}
		}

	}


#include<bits/stdc++.h>
using namespace std;
int a[300005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
	}
	sort(a+1,a+1+n);
	if(a[n]>=a[n-1]+a[n-2]){
		printf("NO\n");
	}else{
		cout<<"YES"<<endl;
		if(n%2){
			for(int i=n;i>=1;i-=2){
				printf("%d ",a[i]);
			}
			for(int i=2;i<=n;i+=2){
				if(i!=2){
					cout<<" ";
				}
				printf("%d",a[i]);
			}
			cout<<endl;
		}else{
			for(int i=n-1;i>=1;i-=2){
				printf("%d ",a[i]);
			}
			for(int i=2;i<=n;i+=2){
				if(i=2){
					printf(" ");
				}
				printf("%d",a[i]);
			}
			cout<<endl;
		}
	}

}


#include<bits/stdc++.h>
using namespace std;
int a[300005];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	if(a[n]>=a[n-1]+a[n-2]){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		if(n%2){
			for(int i=n;i>=1;i-=2){
				cout<<a[i]<<" ";
			}
			for(int i=2;i<=n;i++){
				if(i!=2){
					cout<<" ";
				}
				cout<<a[i];
			}
			cout<<endl;
		}else{
			for(int i=n-1;i>=1;i-=2){
				cout<<a[i]<<" ";
			}
			for(int i=2;i<=n;i+=2){
				if(i=2){
					cout<<" ";
				}
				cout<<a[i];
			}
			cout<<endl;
		}
	}

}


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

    #define FOR(i,a,b) for(int i = (a); i < (b); i++)
    #define rep(i,n) FOR(i,0,n)
    #define RFOR(i,b,a) for(int i = (b) - 1; i>= (a); i--)
    #define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
    #define FILL(a, value) memset(a, value, sizeof(a)

    #define SZ(a) (int)a.size()
    #define ALL(a) a.begin(), a.end()
    #define PB push_back
    #define MP make_pair
    #define er erase
    #define in insert
    #define fs first
    #define sc second

    typedef  long long LL;
    typedef vector<int> VI;
    typedef vector<LL > VL;
    typedef vector<vector<int > > VVI;
    typedef  vector<vector<LL>> VVL;
    typedef vector < vector<pair<int, int >> >VVPI;
    typedef vector<vector<pair<LL, LL >> >VVPL;
    typedef vector<pair<LL, LL >> PL;
    typedef vector<PL> VPL;
    typedef pair<int, int> PII;
    typedef vector<PII> VPI;

    const double PI = acos(-1.0);
    const int INF = 1e9;
    const LL LINF = INF * (LL)INF + 100;

    const double EPS = 1e-7;
    const int MAX = 20 * 1000 + 47;
    const int MAS =  2 *1e5 + 10;
    const int MOD = 1e9 + 7 ;

    priority_queue<int,vector<int > ,greater<int > >q;
    vector<vector<int >> g;
    int main() {
        //freopen("collect.out", "w", stdout);
        // freopen("collect.in", "r", stdin);
        //  8 3 1 2 1 3 3 4 3 5 3 6 6 7 6 8
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n ;
        cin >> n ;
        VI a(n);
        rep(i,n)cin >> a[i];
        sort(ALL(a));
        bool ok = true;
        rep(i,n)
        {
            if(i == 0 )
            {
                if(a[n-1] + a[1] <=a[i])ok&=0;
                continue;
            }
            if(i == n -1)
            {
                if(a[i]>=a[0] + a[i-1])ok&=0;
                continue;
            }
            if(a[i]>= a[i-1] + a[i+1])ok&=0;
        }
        if(!ok)
        {
            cout << "NO";
            return 0;
        }
        else
        {
            cout << "YES" << endl;
            int z =0 ;
            rep(i,n)
            {
                if(i == n -1)
                {
                    cout << a[2] << " ";
                    continue;
                }
                cout << a[i + z] << " " ;
                if(i ==1)z++ ;

            }
        }

    }


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

    #define FOR(i,a,b) for(int i = (a); i < (b); i++)
    #define rep(i,n) FOR(i,0,n)
    #define RFOR(i,b,a) for(int i = (b) - 1; i>= (a); i--)
    #define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
    #define FILL(a, value) memset(a, value, sizeof(a)

    #define SZ(a) (int)a.size()
    #define ALL(a) a.begin(), a.end()
    #define PB push_back
    #define MP make_pair
    #define er erase
    #define in insert
    #define fs first
    #define sc second

    typedef  long long LL;
    typedef vector<int> VI;
    typedef vector<LL > VL;
    typedef vector<vector<int > > VVI;
    typedef  vector<vector<LL>> VVL;
    typedef vector < vector<pair<int, int >> >VVPI;
    typedef vector<vector<pair<LL, LL >> >VVPL;
    typedef vector<pair<LL, LL >> PL;
    typedef vector<PL> VPL;
    typedef pair<int, int> PII;
    typedef vector<PII> VPI;

    const double PI = acos(-1.0);
    const int INF = 1e9;
    const LL LINF = INF * (LL)INF + 100;

    const double EPS = 1e-7;
    const int MAX = 20 * 1000 + 47;
    const int MAS =  2 *1e5 + 10;
    const int MOD = 1e9 + 7 ;

    priority_queue<int,vector<int > ,greater<int > >q;
    vector<vector<int >> g;
    int main() {
        //freopen("collect.out", "w", stdout);
        // freopen("collect.in", "r", stdin);
        //  8 3 1 2 1 3 3 4 3 5 3 6 6 7 6 8
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n ;
        cin >> n ;
        VI a(n);
        rep(i,n)cin >> a[i];
        sort(ALL(a));
        if(a[n-1] >=a[n-2]+ a[n-3])
        {
            cout << "NO"  ;
            return 0;
        }
        swap(a[n-1],a[n-2]);
        rep(i,n)cout << a[i] << " " ;

    }


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

    #define FOR(i,a,b) for(int i = (a); i < (b); i++)
    #define rep(i,n) FOR(i,0,n)
    #define RFOR(i,b,a) for(int i = (b) - 1; i>= (a); i--)
    #define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
    #define FILL(a, value) memset(a, value, sizeof(a)

    #define SZ(a) (int)a.size()
    #define ALL(a) a.begin(), a.end()
    #define PB push_back
    #define MP make_pair
    #define er erase
    #define in insert
    #define fs first
    #define sc second

    typedef  long long LL;
    typedef vector<int> VI;
    typedef vector<LL > VL;
    typedef vector<vector<int > > VVI;
    typedef  vector<vector<LL>> VVL;
    typedef vector < vector<pair<int, int >> >VVPI;
    typedef vector<vector<pair<LL, LL >> >VVPL;
    typedef vector<pair<LL, LL >> PL;
    typedef vector<PL> VPL;
    typedef pair<int, int> PII;
    typedef vector<PII> VPI;

    const double PI = acos(-1.0);
    const int INF = 1e9;
    const LL LINF = INF * (LL)INF + 100;

    const double EPS = 1e-7;
    const int MAX = 20 * 1000 + 47;
    const int MAS =  2 *1e5 + 10;
    const int MOD = 1e9 + 7 ;

    priority_queue<int,vector<int > ,greater<int > >q;
    vector<vector<int >> g;
    int main() {
        //freopen("collect.out", "w", stdout);
        // freopen("collect.in", "r", stdin);
        //  8 3 1 2 1 3 3 4 3 5 3 6 6 7 6 8
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n ;
        cin >> n ;
        VI a(n);
        rep(i,n)cin >> a[i];
        sort(ALL(a));
        bool ok = true;
        rep(i,n)
        {
            if(i == 0 )
            {
                if(a[n-1] + a[1] <=a[i])ok&=0;
                continue;
            }
            if(i == n -1)
            {
                if(a[i]>=a[0] + a[i-1])ok&=0;
                continue;
            }
            if(a[i]>= a[i-1] + a[i+1])ok&=0;
        }
        if(!ok)
        {
            cout << "NO";
            return 0;
        }
        else
        {
            cout << "YES" << endl;
            rep(i,n)
            {
                cout << a[i] << " " ;
            }
        }

    }


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

    #define FOR(i,a,b) for(int i = (a); i < (b); i++)
    #define rep(i,n) FOR(i,0,n)
    #define RFOR(i,b,a) for(int i = (b) - 1; i>= (a); i--)
    #define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
    #define FILL(a, value) memset(a, value, sizeof(a)

    #define SZ(a) (int)a.size()
    #define ALL(a) a.begin(), a.end()
    #define PB push_back
    #define MP make_pair
    #define er erase
    #define in insert
    #define fs first
    #define sc second

    typedef  long long LL;
    typedef vector<int> VI;
    typedef vector<LL > VL;
    typedef vector<vector<int > > VVI;
    typedef  vector<vector<LL>> VVL;
    typedef vector < vector<pair<int, int >> >VVPI;
    typedef vector<vector<pair<LL, LL >> >VVPL;
    typedef vector<pair<LL, LL >> PL;
    typedef vector<PL> VPL;
    typedef pair<int, int> PII;
    typedef vector<PII> VPI;

    const double PI = acos(-1.0);
    const int INF = 1e9;
    const LL LINF = INF * (LL)INF + 100;

    const double EPS = 1e-7;
    const int MAX = 20 * 1000 + 47;
    const int MAS =  2 *1e5 + 10;
    const int MOD = 1e9 + 7 ;

    priority_queue<int,vector<int > ,greater<int > >q;
    vector<vector<int >> g;
    int main() {
        //freopen("collect.out", "w", stdout);
        // freopen("collect.in", "r", stdin);
        //  8 3 1 2 1 3 3 4 3 5 3 6 6 7 6 8
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n ;
        cin >> n ;
        VI a(n);
        rep(i,n)cin >> a[i];
        sort(ALL(a));
        if(a[n-1] >=a[n-2]+ a[n-3])
        {
            cout << "NO"  ;
            return 0;
        }
        cout << "YES" << endl;
        swap(a[n-1],a[n-2]);
        rep(i,n)cout << a[i] << " " ;

    }


/*
* @Author: _dp95
* @Date:   2019-07-05 21:14:00
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

multiset< ll >st ;
vector< ll > v ;

int main( ){
  timesaver ;
  ll n ;
  cin >> n ;
  for( ll i = 0 ; i < n ; i++ ){
    ll x ;
    cin >> x ;
    st.insert( x ) ;
  }
  bool ok = 1 ;
  v.pb( *st.rbegin( ) ) ; st.erase( st.find( *st.rbegin( ) ) ) ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  ll prev = 1 ;
  while( !st.empty( ) ){
    ll req = v[ prev ] + 1 - v[ prev - 1 ] ;
    auto it = st.lower_bound( req ) ;
    if( it == st.end( ) ){
        ok = 0 ;
        break ;
    }
    prev++ ;
    v.pb( *it ) ;
    st.erase( it ) ;
  }
  ok &= ( ( v[ n - 2 ] + v[ 0 ] ) > v[ n - 1 ] ) ;
  ok &= ( ( v[ 1 ] + v[ n- 1 ] ) > v[ 0 ] ) ;
  if( !ok ){
    cout << "NO" << nl ;
    return 0 ;
  }
  cout << "YES" << nl ;
  for( auto i : v ){
    cout << i << " " ;
  }
  cout << nl ;
}


/*
* @Author: _dp95
* @Date:   2019-07-05 21:04:07
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

multiset< int >st ;
vector< int > v ;

int main( ){
  timesaver ;
  int n ;
  cin >> n ;
  for( int i = 0 ; i < n ; i++ ){
    int x ;
    cin >> x ;
    st.insert( x ) ;
  }
  bool ok = 1 ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  int prev = 1 ;
  while( !st.empty( ) ){
    int req = v[ prev ] + 1 - v[ prev - 1 ] ;
    auto it = st.lower_bound( req ) ;
    if( it == st.end( ) ){
        ok = 0 ;
        break ;
    }
    prev++ ;
    v.pb( *it ) ;
    st.erase( it ) ;
  }
  ok &= ( ( v[ n - 2 ] + v[ 0 ] ) > v[ n - 1 ] ) ;
  if( !ok ){
    cout << "NO" << nl ;
    return 0 ;
  }
  cout << "YES" << nl ;
  for( auto i : v ){
    cout << i << " " ;
  }
  cout << nl ;
}


/*
* @Author: _dp95
* @Date:   2019-07-05 21:31:45
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

multiset< int >st ;
vector< int > v ;

int main( ){
  timesaver ;
  int n ;
  cin >> n ;
  for( int i = 0 ; i < n ; i++ ){
    int x ;
    cin >> x ;
    st.insert( x ) ;
  }
  bool ok = 1 ;
  v.pb( *st.rbegin( ) ) ; st.erase( st.find( *st.rbegin( ) ) ) ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  int prev = 1 ;
  while( sz( v ) != n ){
    int req = v[ prev ] + 1 - v[ prev - 1 ] ;
    auto it = st.lower_bound( req ) ;
    if( it == st.end( ) or *it < req ){
        ok = 0 ;
        break ;
    }
    prev++ ;
    v.pb( *it ) ;
    st.erase( it ) ;
  }
  ok &= ( ( v[ n - 2 ] + v[ 0 ] ) > v[ n - 1 ] ) ;
  ok &= ( ( v[ 1 ] + v[ n- 1 ] ) > v[ 0 ] ) ;
  if( !ok ){
    cout << "NO" << nl ;
    return 0 ;
  }
  cout << "YES" << nl ;
  for( auto i : v ){
    cout << i << " " ;
  }
  cout << nl ;
}


/*
* @Author: _dp95
* @Date:   2019-07-06 16:04:00
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

int main( ){
  timesaver ;
  int n ;
  cin >> n ;
  vector< int > v( n ) ;
  for( auto &i : v ){
    cin >> i ;
  }
  sort( all( v ) ) ;
  swap( v[ n - 1 ], v[ n - 2 ] ) ;
  bool ok = 1 ;
  for( int i = 1 ; i <= n - 2 ; i++ ){
    ok &= ( ( v[ i - 1 ] + v[ i + 1 ] ) > v[ i ] ) ;
  }
  ok &= ( ( v[ n - 2 ] + v[ 0 ] ) > v[ n - 1 ] ) ;
  ok &= ( ( v[ n - 1 ] + v[ 1 ] ) > v[ 0 ] ) ;
  if( !ok ){
    cout << "NO" << nl ;
    return 0 ;
  }
  cout << "YES" << nl ;
  for( auto i : v ){
    cout << i << " " ;
  }
  cout << nl ;
}


/*
* @Author: _dp95
* @Date:   2019-07-05 22:03:19
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

multiset< int >st ;
vector< int > v ;

int main( ){
  timesaver ;

    int n ;
  cin >> n ;
  for( int i = 0 ; i < n ; i++ ){
    int x ;
    cin >> x ;
    st.insert( x ) ;
  }
  bool ok = 1 ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  int prev = 1 ;
  while( sz( v ) != n ){
    int req = v[ prev ] + 1 - v[ prev - 1 ] ;
    auto it = st.lower_bound( req ) ;
    if( it == st.end( ) )
        it-- ;
    prev++ ;
    v.pb( *it ) ;
    st.erase( it ) ;
  }
  if( (v[ n - 2 ] + v[ 0 ] ) <= v[ n - 1 ] )
    swap( v[ n - 2 ], v[ n - 1 ] ) ;
  for( int i = 1 ; i <= n - 2 ; i++ ){
      if( ( v[ i - 1 ] + v[ i + 1 ] ) <= v[ i ] )
        ok = 0 ;
    }
  ok &= ( ( v[ n - 2 ] + v[ 0 ] ) > v[ n - 1 ] ) ;
  ok &= ( ( v[ 1 ] + v[ n- 1 ] ) > v[ 0 ] ) ;
  if( !ok ){
    cout << "NO" << nl ;
    return 0 ;
  }
  cout << "YES" << nl ;
  for( auto i : v ){
    cout << i << " " ;
  }
  cout << nl ;

}


/*
* @Author: _dp95
* @Date:   2019-07-05 21:21:41
*/
#include "bits/stdc++.h"
using namespace std ;

#define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end()
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

multiset< int >st ;
vector< int > v ;

int main( ){
  timesaver ;
  int n ;
  cin >> n ;
  for( int i = 0 ; i < n ; i++ ){
    int x ;
    cin >> x ;
    st.insert( x ) ;
  }
  bool ok = 1 ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  v.pb( *st.begin( ) ) ; st.erase( st.begin( ) ) ;
  int prev = 1 ;
  while( !st.empty( ) ){
    int req = v[ prev ] + 1 - v[ prev - 1 ] ;
    auto it = st.lower_bound( req ) ;
    if( it == st.end( ) ){
        ok = 0 ;
        break ;
    }
    prev++ ;
    v.pb( *it ) ;
    st.erase( it ) ;
  }
  ok &= ( ( v[ n - 2 ] + v[ 0 ] ) > v[ n - 1 ] ) ;
  ok &= ( ( v[ 1 ] + v[ n- 1 ] ) > v[ 0 ] ) ;
  if( !ok ){
    cout << "NO" << nl ;
    return 0 ;
  }
  cout << "YES" << nl ;
  for( auto i : v ){
    cout << i << " " ;
  }
  cout << nl ;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,l,m,n;
	while(cin>>n){
        long long x[n];
        for(i=0;i<n;i++) cin>>x[i];
        sort(x,x+n);
        if((x[n-3]+x[n-2])<=x[n-1]) cout<<"NO"<<endl;
       else{ cout<<"YES"<<endl;
       cout<<x[n-1]<<" "<<x[n-2];
       for(i=0;i<n-2;i++) cout<<" "<<x[i];
       }
       cout<<endl;
	}
	return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,l,m,n;
	while(cin>>n){
        int x[n];
        for(i=0;i<n;i++) cin>>x[i];
        sort(x,x+n);
        if((x[n-3]+x[n-2])<x[n-1]) cout<<"NO"<<endl;
       else{ cout<<"YES"<<endl;
                if(n%2==1){
            for(i=1,j=2;j<n;i+=2,j+=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<x[0]<<endl;
        }
        else {
            for(i=0,j=1;j<n;i+=2,j+=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<endl;
        }}
	}
	return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,l,m,n;
	while(cin>>n){
        long long x[n];
        for(i=0;i<n;i++) cin>>x[i];
        sort(x,x+n);
        if((x[n-3]+x[n-2])<=x[n-1]) cout<<"NO"<<endl;
       else{ cout<<"YES"<<endl;
                if(n%2==1){
            for(i=n-1,j=n-2;i>0;i-=2,j-=2){
                cout<<x[j]<<" "<<x[i]<<" ";
            }
            cout<<x[0]<<endl;
        }
        else {
            for(i=n-1,j=n-2;i>=0;i-=2,j-=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<endl;
        }}
	}
	return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,l,m,n;
	while(cin>>n){
        long long x[n];
        for(i=0;i<n;i++) cin>>x[i];
        sort(x,x+n);
        if((x[n-3]+x[n-2])<=x[n-1]) cout<<"NO"<<endl;
       else{ cout<<"YES"<<endl;
                if(n%2==1){
            for(i=n-1,j=n-2;i>0;i-=2,j-=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<x[0]<<endl;
        }
        else {
            for(i=n-1,j=n-2;j>=0;i-=2,j-=2){
                cout<<x[j]<<" "<<x[i]<<" ";
            }
            cout<<endl;
        }}
	}
	return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,l,m,n;
	while(cin>>n){
        long long x[n];
        for(i=0;i<n;i++) cin>>x[i];
        sort(x,x+n);
        if((x[n-3]+x[n-2])<=x[n-1]) cout<<"NO"<<endl;
       else{ cout<<"YES"<<endl;
                if(n%2==1){
            for(i=n-1,j=n-2;i>0;i-=2,j-=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<x[0]<<endl;
        }
        else {
            for(i=n-1,j=n-2;j>=0;i-=2,j-=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<endl;
        }}
	}
	return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,l,m,n;
	while(cin>>n){
        int x[n];
        for(i=0;i<n;i++) cin>>x[i];
        sort(x,x+n);
        if((x[n-3]+x[n-2])<=x[n-1]) cout<<"NO"<<endl;
       else{ cout<<"YES"<<endl;
                if(n%2==1){
            for(i=1,j=2;j<n;i+=2,j+=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<x[0]<<endl;
        }
        else {
            for(i=0,j=1;j<n;i+=2,j+=2){
                cout<<x[i]<<" "<<x[j]<<" ";
            }
            cout<<endl;
        }}
	}
	return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,l,m,n;
	while(cin>>n){
        long long x[n];
        for(i=0;i<n;i++) cin>>x[i];
        sort(x,x+n);
        if((x[n-3]+x[n-2])<=x[n-1]) cout<<"NO"<<endl;
       else{
       cout<<x[n-1]<<" "<<x[n-2];
       for(i=0;i<n-2;i++) cout<<" "<<x[i];
       }
       cout<<endl;
	}
	return 0;}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{   int n,t;cin>>n>>t;
    bool S[28];bool T[28];bool R[28];memset(S,false,sizeof S);memset(T,false,sizeof T);memset(R,false,sizeof R);
    string s1,s2;cin>>s1>>s2;char c;string res="";
    for(int i=0;i<n;i++){
        S[(int)s1[i]-(int)'a']=true;
        T[(int)s2[i]-(int)'a']=true;
        if(S[i] && T[i] && !R[i]) res+=(char)((int)'a'+i);
    }
    //for(int i=0;i<26;i++){cout<<S[i]<<" ";}cout<<endl;
    //for(int i=0;i<26;i++){cout<<T[i]<<" ";}cout<<endl;
    int nb1=0,nb2=0;
    int i=0;
    while(i<26 && nb1<t && nb2<t && res.size()<n){
        if(!S[i] && !T[i]) {res+=(char)((int)'a'+i);nb1++;nb2++;R[i]=true;}
        i++;
    }
    i=0;
    while(i<26 && nb1<t && res.size()<n){
        if(!S[i] && R[i]){res+=(char)((int)'a'+i);nb1++;R[i]=true;}
    }
    i=0;
    while(i<26 && nb2<t && res.size()<n){
        if(!T[i] && !R[i]){res+=(char)((int)'a'+i);nb2++;R[i]=true;}
    }
   i=0;
   while(!R[i]) i++; while(res.size()<n) res+=(char)((int)'a'+i);
   int nb=0; for(int i=0;i<26;i++){if(S[i]^T[i]) nb++;}
    if(nb1!=t || nb2!=t || (nb/2)!=t) cout<<-1<<endl;
    else cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define int long long
#define endl "\n"
using namespace std;
const int nax=1e5+5;
vector<int>adj[nax];
const int mod=1e9+7;
const int inf=1e18+7;
int s1alpha[26];
int s2alpha[26];
string s;

signed main(){
	int n,t;
	cin>>n>>t;
	string s1,s2;
	cin>>s1>>s2;
	int rem_l=n-t;
	for(int i=0; i<n; i++){
		s1alpha[s1[i]-'a']=1;
	}
	for(int i=0; i<n; i++){
		s2alpha[s2[i]-'a']=1;
	}
	int tmp1=rem_l;
	int tmp2=rem_l;
	int t_l=0;
	for(int i=0; i<26; i++){
		if(tmp1==0 || tmp2==0) break;
		if(s1alpha[i]==1 && s2alpha[i]==1){
			s.pb(i+'a');
			tmp1--;
			tmp2--;
			t_l++;
		}
	}
	if(tmp1>0){
		for(int i=0; i<26; i++){
			if(tmp1==0) break;
			if(s1alpha[i]==1 && s2alpha[i]==0){
				s.pb(i+'a');
				tmp1--;
				t_l++;
			}
		}
	}
	if(tmp2>0){
		for(int i=0; i<26; i++){
			if(tmp2==0) break;
			if(s2alpha[i]==1 && s1alpha[i]==0){
				s.pb(i+'a');
				tmp2--;
				t_l++;
			}
		}
	}
	int lst=0;
	int f=0;
	for(int i=0; i<26; i++){
		if(t_l==n) break;
		if(s1alpha[i]==0 && s2alpha[i]==0){
//			cout<<" 1 "<<endl;
			s.pb(i+'a');
			lst=i;
			t_l++;
			f=1;
		}
	}
	if(t_l<n && f==1){
		while(t_l<n){
			s.pb(lst+'a');
			t_l++;
		}
	}
	if(t_l>n){
		cout<<-1<<endl;
	}
	else
		cout<<s<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define int long long
#define endl "\n"
using namespace std;
const int nax=1e5+5;
vector<int>adj[nax];
const int mod=1e9+7;
const int inf=1e18+7;
int s1alpha[26];
int s2alpha[26];
char s[nax];

signed main(){
	int n,t;
	cin>>n>>t;
	string s1,s2;
	cin>>s1>>s2;
	for(int i=0; i<=n; i++){
		s[i]='A';
	}
	int rem_l=n-t;
	for(int i=0; i<n; i++){
		s1alpha[s1[i]-'a']=1;
	}
	for(int i=0; i<n; i++){
		s2alpha[s2[i]-'a']=1;
	}
	int tmp1=rem_l;
	int tmp2=rem_l;
	int t_l=0;
	int sm=0;
	for(int i=0; i<n; i++){
		if(tmp1==0 || tmp2==0) break;
		if(s1[i]==s2[i]){
			s[i]=s1[i];
			tmp1--;
			tmp2--;
			t_l++;
			//cout<<"!" <<endl;
			//cout<<s[i]<<endl;
			sm++;
		}
	}
	//cout<<endl;
	if(rem_l>sm+(n-sm)/2){
		cout<<-1<<endl;
		return 0;
	}
	//cout<<tmp1<<" "<<tmp2<<endl;
	if(tmp1>0){
		for(int i=0; i<n; i++){
			if(tmp1==0) break;
			if(s1[i]!=s2[i]&& s[i]=='A'){
				s[i]=s1[i];
				//cout<<i<<" "<<s1[i]<<endl;
				tmp1--;
				t_l++;
			}
		}
	}
	if(tmp2>0){
		for(int i=0; i<n; i++){
			if(tmp2==0) break;
			if(s2[i]!=s1[i] && s[i]=='A'){
				s[i]=s2[i];
				//cout<<i<<" "<<s2[i]<<endl;
				tmp2--;
				t_l++;
			}
		}
	}
	//cout<<t_l<<endl;
	int lst=0;
	int f=0;
	for(int i=0; i<n; i++){
		if(s[i]=='A'){
	//		cout<<i<<endl;
	//		cout<<" 1 ";
		//	cout<<1<<endl;
			if(s1[i]=='a'&&s2[i]!='a')s[i]=1+s2[i];
			else if(s1[i]!='a'&&s2[i]=='a')s[i]=1+s1[i];
			else if(s1[i]=='a'&&s2[i]=='a')s[i]=1+'a';
			else s[i]='a';
		}
	}
		for(int i=0; i<n; i++) cout<<s[i];
	return 0;
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define int long long
#define endl "\n"
using namespace std;
const int nax=1e5+5;
vector<int>adj[nax];
const int mod=1e9+7;
const int inf=1e18+7;
int s1alpha[26];
int s2alpha[26];
char s[nax];

signed main(){
	int n,t;
	cin>>n>>t;
	string s1,s2;
	cin>>s1>>s2;
	for(int i=0; i<=n; i++){
		s[i]='A';
	}
	int rem_l=n-t;
	for(int i=0; i<n; i++){
		s1alpha[s1[i]-'a']=1;
	}
	for(int i=0; i<n; i++){
		s2alpha[s2[i]-'a']=1;
	}
	int tmp1=rem_l;
	int tmp2=rem_l;
	int t_l=0;
	int sm=0;
	for(int i=0; i<n; i++){
		if(tmp1==0 || tmp2==0) break;
		if(s1[i]==s2[i]){
			s[i]=s1[i];
			tmp1--;
			tmp2--;
			t_l++;
			//cout<<"!" <<endl;
			//cout<<s[i]<<endl;
			sm++;
		}
	}
	if(rem_l>sm+(n-sm)/2){
		cout<<-1<<endl;
		return 0;
	}
	if(tmp1>0){
		for(int i=0; i<n; i++){
			if(tmp1==0) break;
			if(s1alpha[s1[i]-'a']==1 && s2alpha[s2[i]-'a']==0 && s[i]=='A'){
				s[i]=s1[i];
				tmp1--;
				t_l++;
			}
		}
	}
	if(tmp2>0){
		for(int i=0; i<n; i++){
			if(tmp2==0) break;
			if(s2alpha[s2[i]-'a']==1 && s1alpha[s1[i]-'a']==0 && s[i]=='A'){
				s[i]=s2[i];
				tmp2--;
				t_l++;
			}
		}
	}
	//cout<<t_l<<endl;
	int lst=0;
	int f=0;
	for(int i=0; i<n; i++){
		if(t_l==n) break;
		if(s[i]=='A'){
	//		cout<<i<<endl;
//			cout<<" 1 "<<endl;
			t_l++;
		//	cout<<1<<endl;
			if(s1[i]=='a'&&s2[i]!='a')s[i]=1+s2[i];
			else if(s1[i]!='a'&&s2[i]=='a')s[i]=s1[i]+1;
			else if(s1[i]=='a'&&s2[i]=='a')s[i]=1+'a';
			else s[1]='a';
		}
	}
		for(int i=0; i<n; i++) cout<<s[i];
	return 0;
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define int long long
#define endl "\n"
using namespace std;
const int nax=1e5+5;
vector<int>adj[nax];
const int mod=1e9+7;
const int inf=1e18+7;
int s1alpha[26];
int s2alpha[26];
char s[nax];

signed main(){
	int n,t;
	cin>>n>>t;
	string s1,s2;
	cin>>s1>>s2;
	for(int i=0; i<=n; i++){
		s[i]='A';
	}
	int rem_l=n-t;
	for(int i=0; i<n; i++){
		s1alpha[s1[i]-'a']=1;
	}
	for(int i=0; i<n; i++){
		s2alpha[s2[i]-'a']=1;
	}
	int tmp1=rem_l;
	int tmp2=rem_l;
	int t_l=0;
	int sm=0;
	for(int i=0; i<n; i++){
		if(tmp1==0 || tmp2==0) break;
		if(s1[i]==s2[i]){
			s[i]=s1[i];
			tmp1--;
			tmp2--;
			t_l++;
			//cout<<"!" <<endl;
			//cout<<s[i]<<endl;
			sm++;
		}
	}
	//cout<<endl;
	if(rem_l>sm+(n-sm)/2){
		cout<<-1<<endl;
		return 0;
	}
//	cout<<tmp1<<" "<<tmp2<<endl;
	if(tmp1>0){
		for(int i=0; i<n; i++){
			if(tmp1==0) break;
			if(s1alpha[s1[i]-'a']==1 && s2alpha[s2[i]-'a']==0 && s[i]=='A'){
				s[i]=s1[i];
				tmp1--;
				t_l++;
			}
		}
	}
	if(tmp2>0){
		for(int i=0; i<n; i++){
			if(tmp2==0) break;
			if(s2alpha[s2[i]-'a']==1 && s1alpha[s1[i]-'a']==0 && s[i]=='A'){
				s[i]=s2[i];
				tmp2--;
				t_l++;
			}
		}
	}
	//cout<<t_l<<endl;
	int lst=0;
	int f=0;
	for(int i=0; i<n; i++){
		if(s[i]=='A'){
	//		cout<<i<<endl;
	//		cout<<" 1 ";
		//	cout<<1<<endl;
			if(s1[i]=='a'&&s2[i]!='a')s[i]=1+s2[i];
			else if(s1[i]!='a'&&s2[i]=='a')s[i]=1+s1[i];
			else if(s1[i]=='a'&&s2[i]=='a')s[i]=1+'a';
			else s[i]='a';
		}
	}
		for(int i=0; i<n; i++) cout<<s[i];
	return 0;
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define int long long
#define endl "\n"
using namespace std;
const int nax=1e5+5;
vector<int>adj[nax];
const int mod=1e9+7;
const int inf=1e18+7;
int s1alpha[26];
int s2alpha[26];
char s[nax];

signed main(){
	int n,t;
	cin>>n>>t;
	string s1,s2;
	cin>>s1>>s2;
	for(int i=0; i<=n; i++){
		s[i]='A';
	}
	int rem_l=n-t;
	for(int i=0; i<n; i++){
		s1alpha[s1[i]-'a']=1;
	}
	for(int i=0; i<n; i++){
		s2alpha[s2[i]-'a']=1;
	}
	int tmp1=rem_l;
	int tmp2=rem_l;
	int t_l=0;
	int sm=0;
	for(int i=0; i<n; i++){
		if(tmp1==0 || tmp2==0) break;
		if(s1[i]==s2[i]){
			s[i]=s1[i];
			tmp1--;
			tmp2--;
			t_l++;
			//cout<<"!" <<endl;
			//cout<<s[i]<<endl;
			sm++;
		}
	}
	if(rem_l>sm+(n-sm)/2){
		cout<<-1<<endl;
		return 0;
	}
	if(tmp1>0){
		for(int i=0; i<n; i++){
			if(tmp1==0) break;
			if(s1alpha[s1[i]-'a']==1 && s2alpha[s2[i]-'a']==0 && s[i]=='A'){
				s[i]=s1[i];
				tmp1--;
				t_l++;
			}
		}
	}
	if(tmp2>0){
		for(int i=0; i<n; i++){
			if(tmp2==0) break;
			if(s2alpha[s2[i]-'a']==1 && s1alpha[s1[i]-'a']==0 && s[i]=='A'){
				s[i]=s2[i];
				tmp2--;
				t_l++;
			}
		}
	}
	//cout<<t_l<<endl;
	int lst=0;
	int f=0;
	for(int i=0; i<n; i++){
		if(t_l==n) break;
		if(s[i]=='A'){
	//		cout<<i<<endl;
//			cout<<" 1 "<<endl;
			t_l++;
			if(s1[i]=='a'&&s2[i]!='a')s[i]=1+s2[i];
			else if(s1[i]!='a'&&s2[i]=='a')s[i]=s1[i]+1;
			else s[i]='a';
		}
	}
		for(int i=0; i<n; i++) cout<<s[i];
	return 0;
}


#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define int long long
#define endl "\n"
using namespace std;
const int nax=1e5+5;
vector<int>adj[nax];
const int mod=1e9+7;
const int inf=1e18+7;
int s1alpha[26];
int s2alpha[26];
char s[nax];

signed main(){
	int n,t;
	cin>>n>>t;
	string s1,s2;
	cin>>s1>>s2;
	int rem_l=n-t;
	for(int i=0; i<n; i++){
		s1alpha[s1[i]-'a']=1;
	}
	for(int i=0; i<n; i++){
		s2alpha[s2[i]-'a']=1;
	}
	int tmp1=rem_l;
	int tmp2=rem_l;
	int t_l=0;
	int sm=0;
	for(int i=0; i<n; i++){
		if(tmp1==0 || tmp2==0) break;
		if(s1[i]==s2[i]){
			s[i]=s1[i];
			tmp1--;
			tmp2--;
			//cout<<"!" <<endl;
			//cout<<s[i]<<endl;
			sm++;
		}
	}
	//cout<<endl;
	if(rem_l>sm+(n-sm)/2){
		cout<<-1<<endl;
		return 0;
	}
	//cout<<tmp1<<" "<<tmp2<<endl;
	if(tmp1>0){
		for(int i=0; i<n; i++){
			if(tmp1==0) break;
			if(!s[i]){
				s[i]=s1[i];
				//cout<<i<<" "<<s1[i]<<endl;
				tmp1--;
			}
		}
	}
	if(tmp2>0){
		for(int i=0; i<n; i++){
			if(tmp2==0) break;
			if(!s[i]){
				s[i]=s2[i];
				//cout<<i<<" "<<s2[i]<<endl;
				tmp2--;
			}
		}
	}
	//cout<<t_l<<endl;
	int lst=0;
	int f=0;
	for(int i=0; i<n; i++){
		if(!s[i]){
	//		cout<<i<<endl;
	//		cout<<" 1 ";
		//	cout<<1<<endl;
			while(1){
				s[i]=rand()%26+'a';
				if(s[i]!=s1[i]&&s[i]!=s2[i]) break;
			}
		}
	}
		for(int i=0; i<n; i++) cout<<s[i];
	return 0;
}


/* */
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
const int MAX_LEN = 1010;
#define GETLINE(x) fgets(x,MAX_LEN,stdin);
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<double, double> dd;
typedef tuple<int, int, int> iii;
typedef vector<ii> vii;
typedef vector<ll> vll;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N=100100;
int n,tx,cmmn;
set<int> cindx;
char s[N],t[N],ans[N];
int main () {
	scanf("%d %d",&n,&tx);
	scanf("%s",s);
	scanf("%s",t);
	if(strcmp(s,t)==0){
		for(int i=0;i<tx;i++){
			for(char cur='a';cur<='z';cur++)
				if(cur!=s[i])
					{ans[i]=cur;break;}
		}
		for(int i=tx;i<n;i++)
			ans[i]=s[i];
		for(int i=0;i<n;i++)
			printf("%c",ans[i]);
		exit(0);
	}
	for(int i=0;s[i];i++){
		if(s[i]==t[i])cindx.insert(i);
	}
	if(2*tx-(int)cindx.size()>n || 2*tx+(int)cindx.size()<n){printf("-1\n");exit(0);}
	if(2*tx>n){
		for(int i=0;i<n;i++){
			if(cindx.count(i)==1){
				for(char cur='a';cur<='z';cur++)
				if(cur!=s[i])
					{ans[i]=cur;break;}
			}
		}
		tx-=(int)cindx.size();
		int xz=tx;
		int i=0;
		while(tx--){
			while(cindx.count(i)==1)i++;
			ans[i]=s[i];
			i++;
		}
		tx=xz;
		while(tx--){
			while(cindx.count(i)==1)i++;
			ans[i]=t[i];
			i++;
		}
	}
	else {
			for(int i=0;i<n;i++){
			if(cindx.count(i)==0){
				for(char cur='a';cur<='z';cur++)
				if(cur!=s[i] && cur!=t[i])
					{ans[i]=cur;break;}
				}
			else ans[i]=s[i];
			}
	}
	for(int i=0;i<n;i++)
		printf("%c",ans[i]);
}


/* */
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
const int MAX_LEN = 1010;
#define GETLINE(x) fgets(x,MAX_LEN,stdin);
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<double, double> dd;
typedef tuple<int, int, int> iii;
typedef vector<ii> vii;
typedef vector<ll> vll;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N=100100;
int n,tx,cmmn;
char s[N],t[N],ans[N];
int main () {
	memset(ans,0,sizeof ans);
	scanf("%d %d",&n,&tx);
	scanf("%s",s);
	scanf("%s",t);
	tx=n-tx;
	for(int i=0;i<n;i++){
		if(tx==0)break;
		if(s[i]==t[i]){
			ans[i]=s[i];
			tx--;
		}
	}
	int x,y;
	x=y=tx;
	for(int i=0;i<n;i++){
		if(ans[i]==0){
			if(x){
				ans[i]=s[i];
				x--;
				continue;
			}
			if(y){
				ans[i]=t[i];
				y--;
			}
		}
	}
	dbg(x,y);
	for(int i=0;i<n;i++)
		if(ans[i]==0){
			for(char cur='a';cur<='z';cur++)
			if(cur!=s[i] && cur!=t[i])
				{ans[i]=cur;break;}
		}
	if(!y){
		for(int i=0;i<n;i++)
		printf("%c",ans[i]);
	}
	else printf("-1\n");
}


/* */
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
const int MAX_LEN = 1010;
#define GETLINE(x) fgets(x,MAX_LEN,stdin);
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<double, double> dd;
typedef tuple<int, int, int> iii;
typedef vector<ii> vii;
typedef vector<ll> vll;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N=100100;
int n,tx,cmmn;
set<int> cindx;
char s[N],t[N],ans[N];
int main () {
	scanf("%d %d",&n,&tx);
	scanf("%s",s);
	scanf("%s",t);
	if(strcmp(s,t)==0){
		for(int i=0;i<tx;i++){
			for(char cur='a';cur<='z';cur++)
				if(cur!=s[i])
					{ans[i]=cur;break;}
		}
		for(int i=tx;i<n;i++)
			ans[i]=s[i];
		for(int i=0;i<n;i++)
			printf("%c",ans[i]);
		exit(0);
	}
	for(int i=0;s[i];i++){
		if(s[i]==t[i])cindx.insert(i);
	}
	if(2*tx-(int)cindx.size()>n || 2*tx+(int)cindx.size()<n){printf("-1\n");exit(0);}
	if(2*tx>n){
		for(int i=0;i<n;i++){
			if(cindx.count(i)==1){
				for(char cur='a';cur<='z';cur++)
				if(cur!=s[i])
					{ans[i]=cur;break;}
			}
		}
		tx-=(int)cindx.size();
		int xz=tx;
		int i=0;
		while(tx--){
			while(cindx.count(i)==1)i++;
			ans[i]=s[i];
			i++;
		}
		tx=xz;
		while(tx--){
			while(cindx.count(i)==1)i++;
			ans[i]=t[i];
			i++;
		}
	}
	else {
			int already=0;
			for(int i=0;i<n;i++){
			if(cindx.count(i)==0){
				already++;
				for(char cur='a';cur<='z';cur++)
				if(cur!=s[i] && cur!=t[i])
					{ans[i]=cur;break;}
				}
			else ans[i]=s[i];
			}
			if(already<tx){
				for(int i=0;i<n && already<tx;i++){
			if(cindx.count(i)==1){
				already++;
				for(char cur='a';cur<='z';cur++)
				if(cur!=s[i] && cur!=t[i])
					{ans[i]=cur;break;}
				}
			}
		}
	}
	for(int i=0;i<n;i++)
		printf("%c",ans[i]);
}