stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<string>

#include<map>

#include<algorithm>

using namespace std;

string str[110];

int main()

{

    int n,l;

    while(scanf("%d%d",&n,&l)!=EOF){

        for(int i=0;i<n;i++){

            cin>>str[i];

        }

        sort(str,str+n);

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

        printf("\n");

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<algorithm>

#include<stdio.h>

#include<string.h>

#include<queue>

using namespace std;



/*int pre[200006];



int fin(int x)

{

    int r=x;

    while(pre[r]!=r)

        r=pre[r];

    int i=x,j;

    while(i!=r)

    {

        j=pre[i];

        pre[i]=r;

        i=j;

    }

    return r;

}



void unite(int x,int y)

{

    int fx=fin(x);

    int fy=fin(y);

    if(fx!=fy)

        pre[fx]=fy;

}



bool same(int x,int y)

{

    int fx=fin(x);

    int fy=fin(y);

    if(fx!=fy)

        return false;

    return true;

}*/



struct S

{

    char a[105];

};



bool cmp(S a,S b)

{

    return strcmp(a.a,b.a)<0;

}



int main()

{

    int i,k,x,y,j,n,m;

    S p[105];

    scanf("%d %d",&n,&m);

    for(i=0;i<n;i++)

        scanf(" %s",p[i].a);

    sort(p,p+n,cmp);

    for(i=0;i<n;i++)

        printf("%s",p[i].a);

    printf("\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include<stdio.h>

#include<algorithm>

#include<math.h>

#include<stack>

#include<string.h>

#include<queue>

#include<ctype.h>

#include<map>

#include<string>

using namespace std;

int main(){

    int a,b;

    scanf("%d%d",&a,&b);

    char ch[102][102];

    string str[102];

    for(int i=0;i<a;i++){

        scanf("%s",ch[i]);

        str[i]=ch[i];

    }

    sort(str,str+a);

    for(int i=0;i<a;i++){

        cout<<str[i];

    }

    cout<<endl;

}


// Optimized solution to the same problem (faster):
#include<algorithm>

#include<stdio.h>

#include<string.h>

#include<queue>

using namespace std;



/*int pre[200006];



int fin(int x)

{

    int r=x;

    while(pre[r]!=r)

        r=pre[r];

    int i=x,j;

    while(i!=r)

    {

        j=pre[i];

        pre[i]=r;

        i=j;

    }

    return r;

}



void unite(int x,int y)

{

    int fx=fin(x);

    int fy=fin(y);

    if(fx!=fy)

        pre[fx]=fy;

}



bool same(int x,int y)

{

    int fx=fin(x);

    int fy=fin(y);

    if(fx!=fy)

        return false;

    return true;

}*/



struct S

{

    char a[105];

};



bool cmp(S a,S b)

{

    return strcmp(a.a,b.a)<0;

}



int main()

{

    int i,k,x,y,j,n,m;

    S p[105];

    scanf("%d %d",&n,&m);

    for(i=0;i<n;i++)

        scanf(" %s",p[i].a);

    sort(p,p+n,cmp);

    for(i=0;i<n;i++)

        printf("%s",p[i].a);

    printf("\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <set>

#include <map>

#include <stack>

#include <vector>

#include <queue>

#include <string>

#include <cstring>

#include <cmath>

#include <algorithm>

#define esp 1e-9

#define INF 0x3f3f3f3f

#define Pi acos(-1.0)

const int maxn = 1e3;

typedef long long ll;

using namespace std;

struct strstrstr

{

    string s;

};

strstrstr t[maxn];

bool cmp(struct strstrstr &a, struct strstrstr &b)

{

    return a.s < b.s;

}

int main()

{

    int n, l;

    cin>>n>>l;

    for(int i=0;i<n;i++)

    {

        string str;

        cin>>str;

        t[i].s = str;

    }

    sort(t, t+n, cmp);

    for(int i=0;i<n;i++)

        cout<<t[i].s;

    cout<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<algorithm>

#include<stdio.h>

#include<string.h>

#include<queue>

using namespace std;



/*int pre[200006];



int fin(int x)

{

    int r=x;

    while(pre[r]!=r)

        r=pre[r];

    int i=x,j;

    while(i!=r)

    {

        j=pre[i];

        pre[i]=r;

        i=j;

    }

    return r;

}



void unite(int x,int y)

{

    int fx=fin(x);

    int fy=fin(y);

    if(fx!=fy)

        pre[fx]=fy;

}



bool same(int x,int y)

{

    int fx=fin(x);

    int fy=fin(y);

    if(fx!=fy)

        return false;

    return true;

}*/



struct S

{

    char a[105];

};



bool cmp(S a,S b)

{

    return strcmp(a.a,b.a)<0;

}



int main()

{

    int i,k,x,y,j,n,m;

    S p[105];

    scanf("%d %d",&n,&m);

    for(i=0;i<n;i++)

        scanf(" %s",p[i].a);

    sort(p,p+n,cmp);

    for(i=0;i<n;i++)

        printf("%s",p[i].a);

    printf("\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <map>

#include <string>

using namespace std;

int main ()

{

    int n,m;

    cin>>n>>m;

    string a[110];

    for (int i=0;i<n;i++)

    	cin>>a[i];

    map<string, int> str;

    for (int i=0;i<n;i++)

    	str[a[i]]++;

     map<string, int> ::iterator it;

     for (it =str.begin();it!=str.end();it++)

     	for (int i=0;i<it->second;i++)

     		cout<<it->first;

    cout<<endl;

    cout<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <stdio.h>

#include <string.h>

#include <iostream>

#include <algorithm>

#include <math.h>

#include <limits.h>

#include <map>

#include <stack>

#include <queue>

#include <vector>

#include <set>

#include <string>

#define ll long long

#define ull unsigned long long

#define ms(a) memset(a,0,sizeof(a))

#define pi acos(-1.0)

#define INF 0x7f7f7f7f

#define lson o<<1

#define rson o<<1|1

const double E=exp(1);

const int maxn=1e3+10;

const int mod=1e9+7;

using namespace std;

int main(int argc, char const *argv[])

{

	int n,m;

	cin>>n>>m;

	string ch[maxn];

	for(int i=0;i<n;i++)

	{

		cin>>ch[i];

		// a[i]=ch[i][0];

	}

	sort(ch+0,ch+n);

	for(int i=0;i<n;i++)

		cout<<ch[i];

	cout<<endl;

	// n=unique(a,a+n)-a;

	// for(int i=0;i<n;i++)

	// {

	// 	cout<<a[i];

	// 	for(int j=1;j<m;j++)

	// 		cout<<"x";

	// }

	// cout<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



string Array[105];



int main(){

	int N,L;

	scanf("%d %d",&N,&L);

	string s;

	for (int i = 0; i < N; ++i)

	{

		cin >> s;

		Array[i]=s;

	}

	sort(Array,Array+N);

	string Con="";

	for (int i = 0; i < N; ++i)

	{

		Con+=Array[i];

	}

	cout << Con;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main(){

	int n;

	cin>>n;

	int l;

	cin>>l;

	string x;

	vector <string> V(n);

	for(int i=0;i<n;i++){

		cin>>V.at(i);

	}

	sort(V.begin(),V.end());

	int mal=V.size();

	for(int i=0; i<n ; i++){

		cout<<V.at(i);

	}

	cout<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<algorithm>

using namespace std;

static bool  cmp(string s1, string s2){

     return (s1 + s2) < (s2 + s1)? true : false;

}

int main(){

	int n,m,count=0,i,j;

	cin>>n>>m;

	string s[101];



	for( i=0;i<n;i++){

		cin>>s[i];

		count++;

	}

	sort(s,s+count,cmp);

	for(i=0;i<n;i++){

		cout<<s[i];

	}

	cout<<endl; 

	return 0;

}  

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <cstdlib>

#include <algorithm>

#include <iomanip>

#include <climits>

#include <map>

using namespace std;

string s[105];

int main()

{

	int L,N;

	cin >> N >> L;

	for(int i = 1;i <= N;i++){

		cin >> s[i];

	}

	sort(s + 1,s + N + 1);

	for(int i = 1;i <= N;i++){

		cout << s[i];

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
                #include<bits/stdc++.h>

                using namespace std;

                typedef long long ll;

                #define MAX 200005

                int main()

                {

                   vector<string> s;

                   int n , l;

                   scanf("%d%d",&n,&l);

                   for(int i = 0 ; i < n ; i++)

                   {

                       string a;

                       cin>>a;

                       s.push_back(a);

                   }

                   sort(s.begin(),s.end());

                   for(int i = 0 ; i < n ; i++)

                   {

                        printf("%s",s[i].c_str());

                   }

                }


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/*

           Nothing is absolute.

     This is the only absolute truth.

*/



#include<bits/stdc++.h>



using namespace std;



using ull = unsigned long long;

using ll = long long;



#define READ freopen("in.txt", "r", stdin)

#define ROUT freopen("out.txt", "w", stdout)

#define pb push_back

#define endl '\n'



#define REP(i,a,b) for(int i=a; i<=b; i++)

#define arrL(i,a,b) for(int i=a; i<b; i++)



void fasterIO()

{

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

}



void fileIO()

{

    READ;

    ROUT;

}



void solve()

{

    int n, l;



    string s, ans;



    vector<string>v;



    cin>>n>>l;



    while(n--){

        cin>>s;



        v.pb(s);

    }



    sort(begin(v), end(v));



    ans=v[0];



    if(v.size()>1){

        arrL(i, 1, v.size()){

            ans+=v[i];

        }

    }



    cout<<ans<<endl;

}



int main()



{

    ///fileIO();

    fasterIO();



    solve();



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

    char s[105][105];

    int n,l,i,j;

    char a[105];

    int main()

    {

    while(~scanf("%d%d",&n,&l))

       {

       for(i=0;i<n;i++)

          scanf("%s",s[i]);

       for(i=0;i<n-1;i++)

          for(j=0;j<n-1-i;j++)

             if(strcmp(s[j],s[j+1])>0)

                {

                strcpy(a,s[j]);

                strcpy(s[j],s[j+1]);

                strcpy(s[j+1],a);

                }

       for(i=0;i<n;i++)

       printf("%s",s[i]);

       printf("\n");

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
 #include<iostream>

 #include<string>

 using namespace std;



 int main()

 {

     int N,L,i,j;

     string s[101];

     string a[10001];

     string temp;



     cin>>N>>L;

     for(i=0;i<N;i++){

        cin>>s[i];

     }



     for(i=0;i<N;i++){

        for(j=0;j<N-1-i;j++){

            if(s[j]>s[j+1]){

                temp = s[j];

                s[j] = s[j+1];

                s[j+1] = temp;

            }

        }

     }

     for(i=0;i<N;i++){

        cout<<s[i];

     }

     cout<<endl;



     return 0;

 }


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



int main()

{

    int n, m;

    cin>> n >> m;



    string input;



    vector<string>vec;



    for(int i = 1; i <= n; i++)

    {

        cin>> input;

        vec.push_back(input);

    }



    sort(vec.begin(),vec.end());



    for(int i = 0; i < vec.size(); i++)

    {

        cout<< vec[i];

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

 

typedef long long LL;

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<double> VD;

#define MP make_pair

#define PB push_back

#define X first

#define Y second

 

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)

#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 ALL(a) a.begin(), a.end()

#define SZ(a) (int)((a).size())

#define FILL(a, value) memset(a, value, sizeof(a))

#define debug(a) cout << #a << " = " << a << endl;



const double PI = acos(-1.0);

const LL INF = 1e9 + 47;

const LL LINF = INF * INF;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



const int N = 1 << 18;

int n;

PII e[N];

int ptr;



void add(int u, int v)

{

	e[ptr++] = {u, v};

}



int main()

{

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	//freopen("In.txt", "r", stdin);

	//freopen("In.txt", "w", stdout);

	

	cin >> n;

	if (__builtin_popcount(n) == 1)

	{

		cout << "No";

		return 0;

	}

	

	cout << "Yes" << endl;

	

	for(int i = 2; i <= n - 1; i += 2)

	{

		add(1, i);

		add(i, i + 1);

		add(1, n + i + 1);

		add(n + i + 1, n + i);

	}

	

	add(n + 1, n + 2);

	

	if (n % 2 == 0)

	{

		int ksor = n ^ (n - 1);

		add(2 * n, 2 * n - 1);

		add(n, ksor - 1);

	}

	

	assert(ptr == 2 * n - 1);	

	FOR(i, 0, ptr)

		cout << e[i].X << ' ' << e[i].Y << endl;

	

	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

	for (int i=1;i<m-1;i++){

		printf("%d %d\n",i,i+1);

		printf("%d %d\n",n+i,n+i+1);

	}

	printf("%d %d\n",m-1,n+1);

	if (n!=m-1){

		printf("1 %d\n",m+n);

		printf("%d %d\n",m,m+n+1);

	}

	for (int i=m+1;i<=n;i++){

		printf("%d %d\n",i+n-1,i);

		printf("%d %d\n",i-m,i+n);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

using namespace std;

int n;

int main()

{

    // freopen("toad.in","r",stdin);

    // freopen("toad.out","w",stdout);

	scanf("%d",&n);

	int m=1;

	while(m<n) m<<=1;

	if(n<3||m==n)

    {

        printf("No");

        return 0;

    }

	printf("Yes\n");

    printf("%d %d\n",1,n+2);

    printf("%d %d\n",n+2,3);

    printf("%d %d\n",3,n+1);

    printf("%d %d\n",n+1,2);

    printf("%d %d\n",2,n+3);

    for(int i=4;i<n;i+=2)

    {

        printf("%d %d\n",i,n+1);

        printf("%d %d\n",i,n+i+1);

        printf("%d %d\n",i+1,n+1);

        printf("%d %d\n",n+i,i+1);

    }

    if(n%2==0)

    {

        for(int i=2;i<n;i++)

            if((n^(i^1))<n)

            {

                printf("%d %d\n",n,i);

                printf("%d %d\n",n+n,n^i^1);

                break;

            }

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

	for (int i=1;i<m-1;i++){

		printf("%d %d\n",i,i+1);

		printf("%d %d\n",n+i,n+i+1);

	}

	printf("%d %d\n",m-1,n+1);

	if (n!=m-1){

		printf("1 %d\n",m+n);

		printf("%d %d\n",m,m+n+1);

	}

	for (int i=m+1;i<=n;i++){

		printf("%d %d\n",i+n-1,i);

		printf("%d %d\n",i-m,i+n);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define rep(i,a,b) for(int i=(a);i<=(b);i++)

#define per(i,a,b) for(int i=(a);i>=(b);i--)

#define REP(i,n) for(int i=(0);i<(n);i++)

#define fi first

#define se second

#define pb push_back

#define mp make_pair

using namespace std;

typedef pair<int,int> pii;

typedef vector<int> vi;

typedef long long ll;

 

template<class T> inline void read(T &x){

	int f=0;x=0;char ch=getchar();

	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');

	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';

	if(f)x=-x;

}



vector<pii> ans;

int n; 



void add(int a,int b){

	ans.pb(mp(a,b));

}



int main(){

	read(n);

	if(n<=2)return puts("No"),0;

	int k=log(n+0.1)/log(2);

	if(n==(1<<k))return puts("No"),0;

	add(1,2),add(2,3),add(3,n+1);

	add(n+1,n+2),add(n+2,n+3);

	for(int k=4;k<n;k+=2)

		add(1,k),add(k,k+1),

		add(1,n+k+1),add(n+k+1,n+k);

	if(n%2==0){

		int p=__builtin_ctz(n);

		int t=n-(1<<p);

		add(n,1<<p);

		add(n*2,n+t+1);

	}

	puts("Yes");

	for(auto x:ans)

		printf("%d %d\n",x.fi,x.se);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

	for (int i=1;i<m-1;i++){

		printf("%d %d\n",i,i+1);

		printf("%d %d\n",n+i,n+i+1);

	}

	printf("%d %d\n",m-1,n+1);

	if (n!=m-1){

		printf("1 %d\n",m+n);

		printf("%d %d\n",m,m+n+1);

	}

	for (int i=m+1;i<=n;i++){

		printf("%d %d\n",i+n-1,i);

		printf("%d %d\n",i-m,i+n);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <algorithm>

#include <cstring>

#define PII pair<int,int>

#define MP make_pair

#define fir first

#define sec second

#define PB push_back

#define db long double

#define ll long long

using namespace std;

template <class T>

inline void rd(T &x) {

	x=0; char c=getchar(); int f=1;

	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }

	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;

}

int n;

int lowbit(int x) {

	int y=1;

	while(!(x&y)) y<<=1;

	return y;

}

int main() {

	rd(n);

	int k=1; while(k<n) k<<=1;

	if(k==n) { printf("No\n"); return 0; }

	printf("Yes\n");

	printf("%d %d\n",n+1,n+2);

	printf("%d %d\n",n+2,3);

	printf("%d %d\n",3,1);

	printf("%d %d\n",1,2);

	printf("%d %d\n",2,n+3);

	for(int j=4;j+1<=n;j+=2) {

		int k=j+1;

		printf("%d %d\n",j,1);

		printf("%d %d\n",j,n+k);

		printf("%d %d\n",k,1);

		printf("%d %d\n",k,n+j);

	}

	if(!(n&1)) {

		for(int x=2;x<=n-1;++x) {

			int y=n^x^1;

			if(y>=2&&y<=n-1) {

				printf("%d %d\n",n+n,x);

				printf("%d %d\n",n,y);

				break;

			}

		}

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int n,k,m;

int main(){

	scanf("%d",&n); k=0;

	while ((1<<(k+1))-1<=n) k++;

	m=(1<<k);

	if (m==n||n==1){

		puts("No");

		return 0;

	}

	puts("Yes");

	for (int i=1;i<m-1;i++){

		printf("%d %d\n",i,i+1);

		printf("%d %d\n",n+i,n+i+1);

	}

	printf("%d %d\n",m-1,n+1);

	if (n!=m-1){

		printf("1 %d\n",m+n);

		printf("%d %d\n",m,m+n+1);

	}

	for (int i=m+1;i<=n;i++){

		printf("%d %d\n",i+n-1,i);

		printf("%d %d\n",i-m,i+n);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

using namespace std;

int n;

inline int read()

{

	int x = 0, f = 1; char ch = getchar();

	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}

	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}

	return x * f;

}

int main()

{

//	freopen(".in", "r", stdin);

//	freopen(".out", "w", stdout);

	n = read();

	if(!(n & (n - 1))) {puts("No"); return 0;}

	puts("Yes"); puts("1 2"); puts("2 3");

	printf("%d %d\n", 3, n + 1); printf("%d %d\n", n + 1, n + 2); printf("%d %d\n", n + 2, n + 3);

	for(int i = 4; i + 1 <= n; i += 2)

	{

		int j = i + 1;

		printf("%d %d\n", 1, i);

		printf("%d %d\n", 1, j);

		printf("%d %d\n", i, j + n);

		printf("%d %d\n", j, i + n);

	}

	if(n % 2 == 0)

	{

		for(int i = 4; i <= n; i ++)

		{

			int j = n ^ i ^ 1;

			if(j != 3 && j < n)

			{

				printf("%d %d\n", i, n);

				printf("%d %d\n", j, 2 * n);

				return 0;

			}

		}

	}

	fclose(stdin);

	fclose(stdout);

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>



using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int z=1;

	while(z*2<=n)z*=2;

	if(n==z){

		printf("No\n");

		return 0;

	}

	printf("Yes\n");

	for(int i=2;i<n;i+=2){

		printf("%d %d\n",1,i);

		printf("%d %d\n",i,i+1+n);

		printf("%d %d\n",1,i+1);

		printf("%d %d\n",i+1,i+n);

	}

	printf("%d %d\n",n+1,2+n);

	if(n%2==0){

		printf("%d %d\n",z+1,n);

		printf("%d %d\n",n-z,2*n);

	}

}

// Fastest known solution for this problem: