/* be name khoda */

// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <array>
#include <queue>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define XL (x << 1)
#define XR (XL | 1)
#define MD ((l + r) >> 1)
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

// -----------------------------------------------------------------------

const ll maxn = 200010;

ll n, m, comp[maxn], par[maxn];
array<ll, 3> qs[maxn];
pii lr[maxn];

ppi seg[maxn * 2]; // {{r, id}, l}
priority_queue<pii> pq[maxn];

void update(ll p, pii v) {
    seg[p + m] = {v, p};
    for (p = (p + m) >> 1; p; p >>= 1) seg[p] = max(seg[p << 1], seg[p << 1 ^ 1]);
}

void add(ll l, ll r, ll id) {
    pq[l].emplace(r, id);
    if (pq[l].top() != seg[l + m].F) update(l, pq[l].top());
}

void pop(ll l) {
    pq[l].pop();
    pii v = pq[l].empty() ? make_pair(-1, -1) : pq[l].top();
    if (v != seg[l + m].F) update(l, v);
}

ppi get(ll l, ll r) {
    ppi mx = {{-1, -1}, -1};
    for (l += m, r += m; l < r; l >>= 1, r >>= 1) {
        if (l & 1) smax(mx, seg[l]), ++l;
        if (r & 1) --r, smax(mx, seg[r]);
    }
    return mx;
}

ll getid(ll x) {
    return lower_bound(comp, comp + m, x) - comp;
}

ll root(ll x) {
    return par[x] == x ? x : par[x] = root(par[x]);
}

ll isect(ll l, ll r) {
    ppi a = get(0, l);
    if (a.F.F > l) {
        pop(a.S);
        return a.F.S;
    }
    ppi b = get(l + 1, r);
    if (b.F.F > r) {
        pop(b.S);
        return b.F.S;
    }
    return -1;
}

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> n;
    fori (i, n) {
        ll t; cin >> t;
        if (t == 1) {
            ll l, r; cin >> l >> r;
            comp[m++] = l, comp[m++] = r;
            qs[i] = {t, l, r};
        } else {
            ll a, b; cin >> a >> b; --a, --b;
            qs[i] = {t, a, b};
        }
    }
    comp[m++] = -INF;
    sort(comp, comp + m);
    m = unique(comp, comp + m) - comp;

    iota(par, par + n, 0);

    ll in = 0;
    fori (i, n) {
        auto [t, a, b] = qs[i];
        if (t == 1) {
            ll l = getid(a), r = getid(b);
            lr[in] = {l, r};
            ll x;
            while ((x = isect(l, r)) != -1) {
                x = root(x);
                smin(lr[in].F, lr[x].F);
                smax(lr[in].S, lr[x].S);
                par[x] = in;
            }
            add(lr[in].F, lr[in].S, in);
            ++in;
        } else {
            ll ra = root(a), rb = root(b);
            if (ra == rb || lr[rb].F <= lr[ra].F && lr[ra].S <= lr[rb].S) cout << "YES\n";
            else cout << "NO\n";
        }
    }

}


#include<cstdio>
#include<cstring>
#include<set>
#include<map>
#include<iostream>
using namespace std;
const int N = 101000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],len,mx[M],kd[M],lc[M],rc[M],h;
int fd(int x)
{
    if(x!=f[x])f[x]=fd(f[x]);
    return f[x];
}
set<per>lzs[N+N];
map<int,int>seen;
void insert(int x,int v,int id,int L,int R,int& c)
{
    if(!c){c=++len;mx[c]=-INF;}
    if(v>mx[c]){mx[c]=v;kd[c]=id;}
    if(L==R)
    {
        int id=seen[x];
        if(!id)id=seen[x]=++h;
        lzs[id].insert(mp(v,id));
        return ;
    }
    int m=(L+R)/2;
    if(x<=m)insert(x,v,id,L,m,lc[c]);
    else insert(x,v,id,m+1,R,rc[c]);
}
int x;
void find(int l,int r,int L,int R,int c)
{
    if(rd[x]>=mx[c])return ;
    if(l<=L&&r>=R)
    {
        x=kd[c];
        return ;
    }
    int m=(L+R)/2;
    if(l<=m)find(l,r,L,m,lc[c]);
    if(r>m)find(l,r,m+1,R,rc[c]);
}
void del(int x,int v,int id,int L,int R,int c)
{
    if(L==R)
    {
        int id=seen[x];
        lzs[id].erase(mp(v,id));
        if(!lzs[c].empty()){mx[c]=lzs[c].rbegin()->first;kd[c]=lzs[c].rbegin()->second;}
        else {mx[c]=-INF;kd[c]=0;}
        return ;
    }
    int m=(L+R)/2;
    if(x<=m)del(x,v,id,L,m,lc[c]);
    else del(x,v,id,m+1,R,rc[c]);
    if(mx[lc[c]]>mx[rc[c]]){mx[c]=mx[lc[c]];kd[c]=kd[lc[c]];}
    else {mx[c]=mx[rc[c]];kd[c]=kd[rc[c]];}
}
int main()
{
    int i,n,root;
    scanf("%d",&n);
    mx[0]=rd[0]=-INF;
    for(i=1;i<=n;i++)
    {
        f[i]=i;
        int t,a,b;
        scanf("%d%d%d",&t,&a,&b);
        if(t==1)
        {
            L[i]=a;R[i]=b;
            int ll=a,rr=b;
            x=0;
            find(-INF,a-1,-INF,INF,root);
            while(rd[x]>a)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(-INF,a-1,-INF,INF,root);
            }
            x=0;
            find(a,b-1,-INF,INF,root);
            while(rd[x]>b)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(a,b-1,-INF,INF,root);
            }
            ld[i]=ll;rd[i]=rr;
            insert(ll,rr,i,-INF,INF,root);
        }
        else
        {
            if(fd(a)==fd(b)||L[a]>L[b]&&L[a]<R[b])puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<algorithm>
#include<iostream>
using namespace std;
const int N = 201000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],mx[M],kd[M];
int fd(int x)
{
    if(x!=f[x])f[x]=fd(f[x]);
    return f[x];
}
int T[N],A[N],B[N],sv[N+N];
struct P
{
    int l,r,mid;
}arr[8*N];
void build(int L,int R,int c)
{
    arr[c].l=L;
    arr[c].r=R;
    arr[c].mid=(L+R)/2;
    mx[c]=-INF;
    if(L==R)return ;
    build(L,arr[c].mid,c+c);
    build(arr[c].mid+1,R,c+c+1);
}
set<per>lzs[8*N];
void insert(int x,int v,int id,int c)
{
    if(v>mx[c]){mx[c]=v;kd[c]=id;}
    if(arr[c].l==arr[c].r)
    {
        lzs[c].insert(mp(v,id));
        return ;
    }
    if(x<=arr[c].mid)insert(x,v,id,c+c);
    else insert(x,v,id,c+c+1);
}
int x;
void find(int l,int r,int c)
{
    if(rd[x]>=mx[c])return ;
    if(l<=arr[c].l&&r>=arr[c].r)
    {
        x=kd[c];
        return ;
    }
    if(l<=arr[c].mid)find(l,r,c+c);
    if(r>arr[c].mid)find(l,r,c+c+1);
}
void del(int x,int v,int id,int c)
{
    if(arr[c].l==arr[c].r)
    {
        lzs[c].erase(mp(v,id));
        if(!lzs[c].empty()){mx[c]=lzs[c].rbegin()->first;kd[c]=lzs[c].rbegin()->second;}
        else {mx[c]=-INF;kd[c]=0;}
        return ;
    }
    if(x<=arr[c].mid)del(x,v,id,c+c);
    else del(x,v,id,c+c+1);
    if(mx[c+c]>mx[c+c+1]){mx[c]=mx[c+c];kd[c]=kd[c+c];}
    else {mx[c]=mx[c+c+1];kd[c]=kd[c+c+1];}
}
int main()
{
    int i=0,n,h,j=0;
    scanf("%d",&n);
    mx[0]=rd[0]=-INF;
    for(h=0;h<n;h++){scanf("%d%d%d",&T[h],&A[h],&B[h]);if(T[h]==1){sv[j++]=A[h];sv[j++]=B[h];}}
    sort(sv,sv+j);
    int ct=unique(sv,sv+j)-sv;
    //for(i=0;i<ct;i++)printf("i:%d sv:%d \n",i,sv[i]);
    build(1,ct,1);
    i=0;
    for(h=0;h<n;h++)
    {
        int a,b;
        if(T[h]==1)
        {
            i++;
            f[i]=i;
            a=lower_bound(sv,sv+ct,A[h])-sv+1;
            b=lower_bound(sv,sv+ct,B[h])-sv+1;
            //printf("a:%d b:%d \n",a,b);
            L[i]=a;R[i]=b;
            int ll=a,rr=b;
            if(a>1)
            {
                x=0;
                find(1,a-1,1);
                while(rd[x]>a)
                {
                    f[fd(x)]=i;
                    del(ld[x],rd[x],x,1);
                    if(ll>ld[x])ll=ld[x];
                    if(rr<rd[x])rr=rd[x];
                    x=0;
                    find(1,a-1,1);
                }
            }
            x=0;
            find(a,b-1,1);
            while(rd[x]>b)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,1);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(a,b-1,1);
            }
            ld[i]=ll;rd[i]=rr;
            insert(ll,rr,i,1);
        }
        else
        {
            int x=fd(A[h]),y=fd(B[h]);
            if(x==y||(ld[x]>ld[y]&&ld[x]<rd[y]))puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<algorithm>
#include<iostream>
using namespace std;
const int N = 101000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],len,mx[M],kd[M];
int fd(int x)
{
	if(x!=f[x])f[x]=fd(f[x]);
	return f[x];
}
int T[N],A[N],B[N],sv[N+N];
struct P
{
	int l,r,mid;
}arr[8*N];
void build(int L,int R,int c)
{
	arr[c].l=L;
	arr[c].r=R;
	arr[c].mid=(L+R)/2;
	if(L==R)return ;
	build(L,arr[c].mid,c+c);
	build(arr[c].mid+1,R,c+c+1);
}
set<per>lzs[8*N];
void insert(int x,int v,int id,int c)
{
	if(v>mx[c]){mx[c]=v;kd[c]=id;}
	if(arr[c].l==arr[c].r)
	{
		lzs[c].insert(mp(v,id));
		return ;
	}
	if(x<=arr[c].mid)insert(x,v,id,c+c);
	else insert(x,v,id,c+c+1);
}
int x;
void find(int l,int r,int c)
{
	if(rd[x]>=mx[c])return ;
	if(l<=arr[c].l&&r>=arr[c].r)
	{
		x=kd[c];
		return ;
	}
	if(l<=arr[c].mid)find(l,r,c+c);
	if(r>arr[c].mid)find(l,r,c+c+1);
}
void del(int x,int v,int id,int c)
{
	if(arr[c].l==arr[c].r)
	{
		lzs[c].erase(mp(v,id));
		if(!lzs[c].empty()){mx[c]=lzs[c].rbegin()->first;kd[c]=lzs[c].rbegin()->second;}
		else {mx[c]=-INF;kd[c]=0;}
		return ;
	}
	if(x<=arr[c].mid)del(x,v,id,c+c);
	else del(x,v,id,c+c+1);
	if(mx[c+c]>mx[c+c+1]){mx[c]=mx[c+c];kd[c]=kd[c+c];}
	else {mx[c]=mx[c+c+1];kd[c]=kd[c+c+1];}
}
int main()
{
	int i=0,n,h,j=0;
	scanf("%d",&n);
	mx[0]=rd[0]=-INF;
	for(h=0;h<n;h++){scanf("%d%d%d",&T[h],&A[h],&B[h]);if(T[h]==1){sv[j++]=A[h];sv[j++]=B[h];}}
	sort(sv,sv+j);
	int ct=unique(sv,sv+j)-sv;
	//for(i=0;i<ct;i++)printf("i:%d sv:%d \n",i,sv[i]);
	build(1,ct,1);
	i=0;
	for(h=0;h<n;h++)
	{
		int a,b;
		if(T[h]==1)
		{
			i++;
			f[i]=i;
			a=lower_bound(sv,sv+ct,A[h])-sv+1;
			b=lower_bound(sv,sv+ct,B[h])-sv+1;
			//printf("a:%d b:%d \n",a,b);
			L[i]=a;R[i]=b;
			int ll=a,rr=b;
			if(a>1)
			{
				x=0;
				find(1,a-1,1);
				while(rd[x]>a)
				{
					f[fd(x)]=i;
					del(ld[x],rd[x],x,1);
					if(ll>ld[x])ll=ld[x];
					if(rr<rd[x])rr=rd[x];
					x=0;
					find(1,a-1,1);
				}
			}
			x=0;
			find(a,b-1,1);
			while(rd[x]>b)
			{
				f[fd(x)]=i;
				del(ld[x],rd[x],x,1);
				if(ll>ld[x])ll=ld[x];
				if(rr<rd[x])rr=rd[x];
				x=0;
				find(a,b-1,1);
			}
			ld[i]=ll;rd[i]=rr;
			insert(ll,rr,i,1);
		}
		else
		{
			if(fd(A[h])==fd(B[h])||(L[A[h]]>L[B[h]]&&L[A[h]]<R[B[h]]))puts("YES");
			else puts("NO");
		}
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<map>
#include<iostream>
using namespace std;
const int N = 101000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],len,mx[M],kd[M],lc[M],rc[M],h;
int fd(int x)
{
    if(x!=f[x])f[x]=fd(f[x]);
    return f[x];
}
set<per>lzs[N+N];
map<int,int>seen;
void insert(int x,int v,int id,int L,int R,int& c)
{
    if(!c){c=++len;mx[c]=-INF;}
    if(v>mx[c]){mx[c]=v;kd[c]=id;}
    if(L==R)
    {
        int id=seen[x];
        if(!id)id=seen[x]=++h;
        lzs[id].insert(mp(v,id));
        return ;
    }
    int m=L+(R-L)/2;
    if(x<=m)insert(x,v,id,L,m,lc[c]);
    else insert(x,v,id,m+1,R,rc[c]);
}
int x;
void find(int l,int r,int L,int R,int c)
{
    if(rd[x]>=mx[c])return ;
    if(l<=L&&r>=R)
    {
        x=kd[c];
        return ;
    }
    int m=L+(R-L)/2;
    if(l<=m)find(l,r,L,m,lc[c]);
    if(r>m)find(l,r,m+1,R,rc[c]);
}
void del(int x,int v,int id,int L,int R,int c)
{
    if(L==R)
    {
        int id=seen[x];
        lzs[id].erase(mp(v,id));
        if(!lzs[id].empty()){mx[c]=lzs[id].rbegin()->first;kd[c]=lzs[id].rbegin()->second;}
        else {mx[c]=-INF;kd[c]=0;}
        return ;
    }
    int m=L+(R-L)/2;
    if(x<=m)del(x,v,id,L,m,lc[c]);
    else del(x,v,id,m+1,R,rc[c]);
    if(mx[lc[c]]>mx[rc[c]]){mx[c]=mx[lc[c]];kd[c]=kd[lc[c]];}
    else {mx[c]=mx[rc[c]];kd[c]=kd[rc[c]];}
}
int main()
{
    int i,n,root=0,j=0;
    scanf("%d",&n);
    mx[0]=rd[0]=-INF;
    while(n--)
    {
        int t,a,b;
        scanf("%d%d%d",&t,&a,&b);
        if(t==1)
        {
            j++;
            i=j;
            f[i]=i;
            L[i]=a;R[i]=b;
            int ll=a,rr=b;
            x=0;
            find(-INF,a-1,-INF,INF,root);
            while(rd[x]>a)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(-INF,a-1,-INF,INF,root);
            }
            x=0;
            find(a,b-1,-INF,INF,root);
            while(rd[x]>b)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(a,b-1,-INF,INF,root);
            }
            ld[i]=ll;rd[i]=rr;
            insert(ll,rr,i,-INF,INF,root);
        }
        else
        {
            int x=fd(a),y=fd(b);
            if(x==y||(ld[x]>ld[y]&&ld[x]<rd[y])||(rd[x]>ld[y]&&rd[x]<rd[y]))puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<map>
#include<iostream>
using namespace std;
const int N = 101000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],len,mx[M],kd[M],lc[M],rc[M],h;
int fd(int x)
{
    if(x!=f[x])f[x]=fd(f[x]);
    return f[x];
}
set<per>lzs[N+N];
map<int,int>seen;
void insert(int x,int v,int id,int L,int R,int& c)
{
    if(!c){c=++len;mx[c]=-INF;}
    if(v>mx[c]){mx[c]=v;kd[c]=id;}
    if(L==R)
    {
        int id=seen[x];
        if(!id)id=seen[x]=++h;
        lzs[id].insert(mp(v,id));
        return ;
    }
    int m=L+(R-L)/2;
    if(x<=m)insert(x,v,id,L,m,lc[c]);
    else insert(x,v,id,m+1,R,rc[c]);
}
int x;
void find(int l,int r,int L,int R,int c)
{
    if(rd[x]>=mx[c])return ;
    if(l<=L&&r>=R)
    {
        x=kd[c];
        return ;
    }
    int m=L+(R-L)/2;
    if(l<=m)find(l,r,L,m,lc[c]);
    if(r>m)find(l,r,m+1,R,rc[c]);
}
void del(int x,int v,int id,int L,int R,int c)
{
    if(L==R)
    {
        int id=seen[x];
        lzs[id].erase(mp(v,id));
        if(!lzs[id].empty()){mx[c]=lzs[id].rbegin()->first;kd[c]=lzs[id].rbegin()->second;}
        else {mx[c]=-INF;kd[c]=0;}
        return ;
    }
    int m=L+(R-L)/2;
    if(x<=m)del(x,v,id,L,m,lc[c]);
    else del(x,v,id,m+1,R,rc[c]);
    if(mx[lc[c]]>mx[rc[c]]){mx[c]=mx[lc[c]];kd[c]=kd[lc[c]];}
    else {mx[c]=mx[rc[c]];kd[c]=kd[rc[c]];}
}
int main()
{
    int i,n,root=0,j=0;
    scanf("%d",&n);
    mx[0]=rd[0]=-INF;
    while(n--)
    {
        int t,a,b;
        scanf("%d%d%d",&t,&a,&b);
        if(t==1)
        {
            j++;
            i=j;
            f[i]=i;
            L[i]=a;R[i]=b;
            int ll=a,rr=b;
            x=0;
            find(-INF,a-1,-INF,INF,root);
            while(rd[x]>a)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(-INF,a-1,-INF,INF,root);
            }
            x=0;
            find(a,b-1,-INF,INF,root);
            while(rd[x]>b)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(a,b-1,-INF,INF,root);
            }
            ld[i]=ll;rd[i]=rr;
            insert(ll,rr,i,-INF,INF,root);
        }
        else
        {
            if(fd(a)==fd(b)||(L[a]>L[b]&&L[a]<R[b]))puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<algorithm>
#include<iostream>
using namespace std;
const int N = 101000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],mx[M],kd[M];
int fd(int x)
{
    if(x!=f[x])f[x]=fd(f[x]);
    return f[x];
}
int T[N],A[N],B[N],sv[N+N];
struct P
{
    int l,r,mid;
}arr[8*N];
void build(int L,int R,int c)
{
    arr[c].l=L;
    arr[c].r=R;
    arr[c].mid=(L+R)/2;
    mx[c]=-INF;
    if(L==R)return ;
    build(L,arr[c].mid,c+c);
    build(arr[c].mid+1,R,c+c+1);
}
set<per>lzs[8*N];
void insert(int x,int v,int id,int c)
{
    if(v>mx[c]){mx[c]=v;kd[c]=id;}
    if(arr[c].l==arr[c].r)
    {
        lzs[c].insert(mp(v,id));
        return ;
    }
    if(x<=arr[c].mid)insert(x,v,id,c+c);
    else insert(x,v,id,c+c+1);
}
int x;
void find(int l,int r,int c)
{
    if(rd[x]>=mx[c])return ;
    if(l<=arr[c].l&&r>=arr[c].r)
    {
        x=kd[c];
        return ;
    }
    if(l<=arr[c].mid)find(l,r,c+c);
    if(r>arr[c].mid)find(l,r,c+c+1);
}
void del(int x,int v,int id,int c)
{
    if(arr[c].l==arr[c].r)
    {
        lzs[c].erase(mp(v,id));
        if(!lzs[c].empty()){mx[c]=lzs[c].rbegin()->first;kd[c]=lzs[c].rbegin()->second;}
        else {mx[c]=-INF;kd[c]=0;}
        return ;
    }
    if(x<=arr[c].mid)del(x,v,id,c+c);
    else del(x,v,id,c+c+1);
    if(mx[c+c]>mx[c+c+1]){mx[c]=mx[c+c];kd[c]=kd[c+c];}
    else {mx[c]=mx[c+c+1];kd[c]=kd[c+c+1];}
}
int main()
{
    int i=0,n,h,j=0;
    scanf("%d",&n);
    mx[0]=rd[0]=-INF;
    for(h=0;h<n;h++){scanf("%d%d%d",&T[h],&A[h],&B[h]);if(T[h]==1){sv[j++]=A[h];sv[j++]=B[h];}}
    sort(sv,sv+j);
    int ct=unique(sv,sv+j)-sv;
    //for(i=0;i<ct;i++)printf("i:%d sv:%d \n",i,sv[i]);
    build(1,ct,1);
    i=0;
    for(h=0;h<n;h++)
    {
        int a,b;
        if(T[h]==1)
        {
            i++;
            f[i]=i;
            a=lower_bound(sv,sv+ct,A[h])-sv+1;
            b=lower_bound(sv,sv+ct,B[h])-sv+1;
            //printf("a:%d b:%d \n",a,b);
            L[i]=a;R[i]=b;
            int ll=a,rr=b;
            if(a>1)
            {
                x=0;
                find(1,a-1,1);
                while(rd[x]>a)
                {
                    f[fd(x)]=i;
                    del(ld[x],rd[x],x,1);
                    if(ll>ld[x])ll=ld[x];
                    if(rr<rd[x])rr=rd[x];
                    x=0;
                    find(1,a-1,1);
                }
            }
            x=0;
            find(a,b-1,1);
            while(rd[x]>b)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,1);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(a,b-1,1);
            }
            ld[i]=ll;rd[i]=rr;
            insert(ll,rr,i,1);
        }
        else
        {
            int x=fd(A[h]),y=fd(B[h]);
            if(x==y||(ld[x]>ld[y]&&ld[x]<rd[y]))puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<map>
#include<iostream>
using namespace std;
const int N = 101000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],len,mx[M],kd[M],lc[M],rc[M],h;
int fd(int x)
{
    if(x!=f[x])f[x]=fd(f[x]);
    return f[x];
}
set<per>lzs[N+N];
map<int,int>seen;
void insert(int x,int v,int id,int L,int R,int& c)
{
    if(!c){c=++len;mx[c]=-INF;}
    if(v>mx[c]){mx[c]=v;kd[c]=id;}
    if(L==R)
    {
        int id=seen[x];
        if(!id)id=seen[x]=++h;
        lzs[id].insert(mp(v,id));
        return ;
    }
    int m=L+(R-L)/2;
    if(x<=m)insert(x,v,id,L,m,lc[c]);
    else insert(x,v,id,m+1,R,rc[c]);
}
int x;
void find(int l,int r,int L,int R,int c)
{
    if(rd[x]>=mx[c])return ;
    if(l<=L&&r>=R)
    {
        x=kd[c];
        return ;
    }
    int m=L+(R-L)/2;
    if(l<=m)find(l,r,L,m,lc[c]);
    if(r>m)find(l,r,m+1,R,rc[c]);
}
void del(int x,int v,int id,int L,int R,int c)
{
    if(L==R)
    {
        int id=seen[x];
        lzs[id].erase(mp(v,id));
        if(!lzs[id].empty()){mx[c]=lzs[id].rbegin()->first;kd[c]=lzs[id].rbegin()->second;}
        else {mx[c]=-INF;kd[c]=0;}
        return ;
    }
    int m=L+(R-L)/2;
    if(x<=m)del(x,v,id,L,m,lc[c]);
    else del(x,v,id,m+1,R,rc[c]);
    if(mx[lc[c]]>mx[rc[c]]){mx[c]=mx[lc[c]];kd[c]=kd[lc[c]];}
    else {mx[c]=mx[rc[c]];kd[c]=kd[rc[c]];}
}
int main()
{
    int i,n,root=0;
    scanf("%d",&n);
    mx[0]=rd[0]=-INF;
    for(i=1;i<=n;i++)
    {
        f[i]=i;
        int t,a,b;
        scanf("%d%d%d",&t,&a,&b);
        if(t==1)
        {
            L[i]=a;R[i]=b;
            int ll=a,rr=b;
            x=0;
            find(-INF,a-1,-INF,INF,root);
            while(rd[x]>a)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(-INF,a-1,-INF,INF,root);
            }
            x=0;
            find(a,b-1,-INF,INF,root);
            while(rd[x]>b)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,-INF,INF,root);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(a,b-1,-INF,INF,root);
            }
            ld[i]=ll;rd[i]=rr;
            insert(ll,rr,i,-INF,INF,root);
        }
        else
        {
            if(fd(a)==fd(b)||(L[a]>L[b]&&L[a]<R[b]))puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<set>
#include<algorithm>
#include<iostream>
using namespace std;
const int N = 201000;
const int M = 3201000;
const int INF = 1000000005;
typedef pair<int,int> per;
#define mp(x,y) make_pair(x,y)
int L[N],R[N],ld[N],rd[N],f[N],mx[M],kd[M];
int fd(int x)
{
    if(x!=f[x])f[x]=fd(f[x]);
    return f[x];
}
int T[N],A[N],B[N],sv[N+N];
struct P
{
    int l,r,mid;
}arr[8*N];
void build(int L,int R,int c)
{
    arr[c].l=L;
    arr[c].r=R;
    arr[c].mid=(L+R)/2;
    mx[c]=-INF;
    if(L==R)return ;
    build(L,arr[c].mid,c+c);
    build(arr[c].mid+1,R,c+c+1);
}
set<per>lzs[8*N];
void insert(int x,int v,int id,int c)
{
    if(v>mx[c]){mx[c]=v;kd[c]=id;}
    if(arr[c].l==arr[c].r)
    {
        lzs[c].insert(mp(v,id));
        return ;
    }
    if(x<=arr[c].mid)insert(x,v,id,c+c);
    else insert(x,v,id,c+c+1);
}
int x;
void find(int l,int r,int c)
{
    if(rd[x]>=mx[c])return ;
    if(l<=arr[c].l&&r>=arr[c].r)
    {
        x=kd[c];
        return ;
    }
    if(l<=arr[c].mid)find(l,r,c+c);
    if(r>arr[c].mid)find(l,r,c+c+1);
}
void del(int x,int v,int id,int c)
{
    if(arr[c].l==arr[c].r)
    {
        lzs[c].erase(mp(v,id));
        if(!lzs[c].empty()){mx[c]=lzs[c].rbegin()->first;kd[c]=lzs[c].rbegin()->second;}
        else {mx[c]=-INF;kd[c]=0;}
        return ;
    }
    if(x<=arr[c].mid)del(x,v,id,c+c);
    else del(x,v,id,c+c+1);
    if(mx[c+c]>mx[c+c+1]){mx[c]=mx[c+c];kd[c]=kd[c+c];}
    else {mx[c]=mx[c+c+1];kd[c]=kd[c+c+1];}
}
int main()
{
    int i=0,n,h,j=0;
    scanf("%d",&n);
    mx[0]=rd[0]=-INF;
    for(h=0;h<n;h++){scanf("%d%d%d",&T[h],&A[h],&B[h]);if(T[h]==1){sv[j++]=A[h];sv[j++]=B[h];}}
    sort(sv,sv+j);
    int ct=unique(sv,sv+j)-sv;
    //for(i=0;i<ct;i++)printf("i:%d sv:%d \n",i,sv[i]);
    build(1,ct,1);
    i=0;
    for(h=0;h<n;h++)
    {
        int a,b;
        if(T[h]==1)
        {
            i++;
            f[i]=i;
            a=lower_bound(sv,sv+ct,A[h])-sv+1;
            b=lower_bound(sv,sv+ct,B[h])-sv+1;
            //printf("a:%d b:%d \n",a,b);
            L[i]=a;R[i]=b;
            int ll=a,rr=b;
            if(a>1)
            {
                x=0;
                find(1,a-1,1);
                while(rd[x]>a)
                {
                    f[fd(x)]=i;
                    del(ld[x],rd[x],x,1);
                    if(ll>ld[x])ll=ld[x];
                    if(rr<rd[x])rr=rd[x];
                    x=0;
                    find(1,a-1,1);
                }
            }
            x=0;
            find(a,b-1,1);
            while(rd[x]>b)
            {
                f[fd(x)]=i;
                del(ld[x],rd[x],x,1);
                if(ll>ld[x])ll=ld[x];
                if(rr<rd[x])rr=rd[x];
                x=0;
                find(a,b-1,1);
            }
            ld[i]=ll;rd[i]=rr;
            insert(ll,rr,i,1);
        }
        else
        {
            int x=fd(A[h]),y=fd(B[h]);
            if(x==y||(ld[x]>ld[y]&&ld[x]<rd[y])||(rd[x]>ld[y]&&rd[x]<rd[y]))puts("YES");
            else puts("NO");
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
vector<char>vec;
int main()
{
    int n,m,len,len2;
    string s,s2="",s3="";
    cin>>n>>m;
    cin>>s;
    len=s.size();
    if(s[0]==s[len-1]){
            for(int i=0;i<m;i++)
            {
                s2+=s;
            }
            len2=s2.size();
            for(int i=0;i<len;i++)
            {
                vec.push_back(s2[i]);
            }
            for(int j=len;j<len2;j++)

            {
               if(j%len==0)
               {
                   continue;
               }
               else

               {
                   vec.push_back(s2[j]);
               }
            }
            int pos=vec.size();
            for(int k=0;k<pos;k++)
            {
                cout<<vec[k];
            }
            cout<<endl;
            vec.clear();
    }
    else
    {
         for(int i=0;i<m;i++)
            {
                s2+=s;
            }
            cout<<s2<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,m;
    string s,sb,sc;
    cin>>n>>m;
    cin>>s;
    for(int i=1;i<n;i++)
    {
        sb=substr(i);
        if(s.find(sb)==0){
            sc=substr(s.begin()+i);
            break;
        }
    }
    for(int i=0;i<m;i++)
    {
    cout<<sc;
    }
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
vector<char>vec;
int main()
{
    int n,m;
    string s1,s2="";
    cin>>n>>m;
    cin>>s1;
    for(int i=0;i<m;i++)
    {
        s2=s2+s1;
    }
    int len=s2.size();
    for(int i=0;i<len;i++)
    {
        if(s2[i]!=s2[i+1])
        {
         vec.push_back(s2[i]);
        }
    }
    int len1=vec.size();
    for(int k=0;k<len1;k++)
    {
        cout<<vec[k];
    }
    cout<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,p=0,k;
   string sb,s;
   cin>>n>>k;
    cin>>s;
    for(int i=1;i<n;i++)
{
      sb=s.substr(i);
       if(s.find(sb)==0)
        {
         p=i;
         break;
        }

}
  if(p)
{
  for(int j=0;j<k;j++)
{
   cout<<s.substr(0,p);
}
        cout<<sb<<endl;
}
else
{
for(int j=0;j<k;j++)
{
cout<<s;
 }
        cout<<endl;

}
return 0;

}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    string s2 = s;
    int c = 0;
    for(int i = 1; i < s.size(); i++){
        for(int j = i; j < s.size(); j++){
            if(s[j] != s2[j-i]) {
                break;
            }
            if(j + i >= s.size()){
                c = i;
                i = s.size();
            }
        }
    }

    if(c == 0) string pre = s;
    string pre = s.substr(0, c);
    string suf = s.substr(c, s.size());

    for(int i = 0; i < b; i++){
        cout << pre;
    }
    cout << suf << endl;
    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    string s2 = s;
    int c = 0;
    for(int i = 1; i < s.size(); i++){
        for(int j = 0; j+i < s.size(); j++){
            if(s[j+i] != s2[j]) {
                break;
            }
            if(j+i == s.size()-1){
                c = i;
                i = s.size();
            }
        }
    }

    string pre = s.substr(0, c);
    string suf = s.substr(c, s.size());

    if(c == 0){
        pre = s;
        suf = "";
    }

    for(int i = 0; i < b; i++){
        cout << pre;
    }
    cout << suf << endl;
    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    int c = 0;

    int l = 0;
    int r = s.size()-1;

    while(l < r) {
        c += s[l] == s[r];
        l++;
        r--;
    }

    string e = "";

    e += s[0];

    for(int i = 1; i < s.size(); i++){
        if(s[i] != s[0]) {
            e = s.substr(c, s.size());
            break;
        }
    }

    cout << s;

    for(int i = 1; i < b; i++){
        cout << e;
    }
    cout << endl;

    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);
    if(s[0] == s[s.size()-1] && s.size() > 0){
        for(int i = 0; i < b; i++){
            cout << s.substr(0, s.size()-1);
        }
        cout << s[s.size()-1] << endl;
    }else{
        for(int i = 0; i < b; i++){
            cout << s;
        }
        cout << endl;
    }
    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    int c = 0;

    int l = 0;
    int r = (s.size() / 2) + s.size()%2;

    while(r < s.size()) {
        c += s[l] == s[r];
        l++;
        r++;
    }

    string e = "";

    e += s[0];

    for(int i = 1; i < s.size(); i++){
        if(s[i] != s[0]) {
            e = s.substr(c, s.size());
            break;
        }
    }

    cout << s;

    for(int i = 1; i < b; i++){
        cout << e;
    }
    cout << endl;

    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);
    if(s[0] == s[s.size()-1] && s.size() > 1){
        for(int i = 0; i < b; i++){
            cout << s.substr(0, s.size()-1);
        }
        cout << s[s.size()-1] << endl;
    }else{
        for(int i = 0; i < b; i++){
            cout << s;
        }
        cout << endl;
    }
    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    int c = 0;

    int l = 0;
    int r = (s.size() / 2) + s.size()%2;

    while(r < s.size()) {
        c += s[l] == s[r];
        if(s[l] != s[r]) {
            c = 0;
            break;
        }
        l++;
        r++;
    }

    string e = "";

    e += s[0];

    for(int i = 1; i < s.size(); i++){
        if(s[i] != s[0]) {
            e = s.substr(c, s.size());
            break;
        }
    }

    cout << s;

    for(int i = 1; i < b; i++){
        cout << e;
    }
    cout << endl;

    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    string s2 = s;
    int c = 0;
    for(int i = 1; i < s.size(); i++){
        for(int j = i; j < s.size(); j++){
            if(s[j] != s2[j-i]) {
                break;
            }
            if(j + i >= s.size()){
                c = i;
                i = s.size();
            }
        }
    }

    string pre = s.substr(0, c);
    string suf = s.substr(c, s.size());

    if(c == 0){
        pre = s;
        suf = "";
    }

    for(int i = 0; i < b; i++){
        cout << pre;
    }
    cout << suf << endl;
    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    string s2 = s;
    int c = 0;
    for(int i = 1; i < s.size(); i++){
        for(int j = 0; j < s.size()-i; j++){
            if(s[j+i] != s2[j]) {
                break;
            }
            if( j >= s.size()-i){
                c = i;
                i = s.size();
            }
        }
    }

    c = 0;
    cout << c << endl;

    string pre = s.substr(0, c);
    string suf = s.substr(c, s.size());

    if(c == 0){
        pre = s;
        suf = "";
    }

    for(int i = 0; i < b; i++){
        cout << pre;
    }
    cout << suf << endl;
    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    int c = 0;

    int l = 0;
    int r = s.size()-1;

    while(l < r) {
        c += s[l] == s[r];
        l++;
        r--;
    }

    string e = "";

    e += s[0];

    for(int i = 1; i < s.size(); i++){
        if(s[i] != s[0]) {
            e = s.substr(c, s.size());
            break;
        }
    }

    cout << e << endl;

    cout << s;

    for(int i = 1; i < b; i++){
        cout << e;
    }
    cout << endl;

    // if(s[0] == s[s.size()-1] && s.size() > 1){
    //     bool ok = true;
    //     char k = s[0];
    //     for(int i = 1; i < a; i++){
    //         if(s[i] != k){
    //            ok = false;
    //            break;
    //         }
    //     }

    //     if(ok) {
    //         cout << s;
    //         for(int i = 1; i < b; i++){
    //             cout << k;
    //         }
    //         cout << endl;
    //         return 0;
    //     }
    //     for(int i = 0; i < b; i++){
    //         cout << s.substr(0, s.size()-1);
    //     }
    //     cout << s[s.size()-1] << endl;
    // }else{
    //     for(int i = 0; i < b; i++){
    //         cout << s;
    //     }
    //     cout << endl;
    // }
    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    cin.ignore();
    string s;
    getline(cin, s);

    string s2 = s;
    int c = 0;
    for(int i = 1; i < s.size(); i++){
        for(int j = 0; j < s.size()-i; j++){
            if(s[j+i] != s2[j]) {
                break;
            }
            if( j >= s.size()-i){
                c = i;
                i = s.size();
            }
        }
    }

    string pre = s.substr(0, c);
    string suf = s.substr(c, s.size());

    if(c == 0){
        pre = s;
        suf = "";
    }

    for(int i = 0; i < b; i++){
        cout << pre;
    }
    cout << suf << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
vector<int >prefix;
vector<int >position ;
string p;
void compute_prefix()
{
    long long m=p.size();
    prefix.push_back(0);
    long long i=1,len=0;
    while(i<m)
    {
        if(p[i]==p[len])
        {
            len++;
            prefix.push_back(len);
            i++;
        }
        else
        {
            if(len!=0)
            {
                len=prefix[len-1];
            }
            else
            {
                prefix.push_back(0);
                i++;
            }
        }
    }
}
int main()
{
    int n,k,l,m,j,t,q;
    cin>>n>>k;
    cin>>p;
    compute_prefix();
    m=prefix.size();
    if(prefix[m-1]!=0) {
        t=prefix[m-1]-1;
        q=n-1-prefix[m-1];
        if(t<n && q>0)
        {
            while(k--)for(int i=0; i<=q; i++)cout<<p[i];
            for(int i=0; i<=t; i++)cout<<p[i];
        }
        else
        {
             for(int i=1; i<=n+k-1; i++)cout<<p[0];
        }
    }
    else while(k--)  for(int i=0; i<n; i++)cout<<p[i];
    cout<<endl;
    //main();
}


#include<bits/stdc++.h>
using namespace std;
vector<int >prefix;
vector<int >position ;
string p;
void compute_prefix()
{
    long long m=p.size();
    prefix.push_back(0);
    long long i=1,len=0;
    while(i<m)
    {
        if(p[i]==p[len])
        {
            len++;
            prefix.push_back(len);
            i++;
        }
        else
        {
            if(len!=0)
            {
                len=prefix[len-1];
            }
            else
            {
                prefix.push_back(0);
                i++;
            }
        }
    }
}
int main()
{
    int n,k,l,m,j,t,q;
    cin>>n>>k;
    cin>>p;
    compute_prefix();
    m=prefix.size();
    if(prefix[m-1]!=0) {
        t=prefix[m-1]-1;
        q=n-1-prefix[m-1];
        if(t<n && q>0)
        {
            while(k--)for(int i=0; i<=q; i++)cout<<p[i];
            for(int i=0; i<=t; i++)cout<<p[i];
        }
        else
        {
            if(n<=k)
            {
                k--;
                while(k--)  for(int i=1; i<=n-1; i++)cout<<p[0];
                cout<<p[0];
            }
            else while(k--)  for(int i=0; i<n; i++)cout<<p[i];
        }
    }
    else while(k--)  for(int i=0; i<n; i++)cout<<p[i];
    cout<<endl;
    main();
}


#include<bits/stdc++.h>
using namespace std;
vector<int >prefix;
vector<int >position ;
string p;
void compute_prefix()
{
    long long m=p.size();
    prefix.push_back(0);
    long long i=1,len=0;
    while(i<m)
    {
        if(p[i]==p[len])
        {
            len++;
            prefix.push_back(len);
            i++;
        }
        else
        {
            if(len!=0)
            {
                len=prefix[len-1];
            }
            else
            {
                prefix.push_back(0);
                i++;
            }
        }
    }
}
int main()
{
    int n,k,l,m,j,t,q;
    cin>>n>>k;
    cin>>p;
    compute_prefix();
    m=prefix.size();
    if(prefix[m-1]!=0) {
        t=prefix[m-1]-1;
        q=n-1-prefix[m-1];
        if(t<n && q>0)
        {
            while(k--)for(int i=0; i<=q; i++)cout<<p[i];
            for(int i=0; i<=t; i++)cout<<p[i];
        }
        else
        {
            if(n<k)
            {
                k--;
                while(k--)  for(int i=1; i<=n-1; i++)cout<<p[0];
                cout<<p[0];
            }
            else if(n==k)for(int i=1; i<=n+n-1; i++)cout<<p[0];
            else
            while(k--)  for(int i=0; i<n; i++)cout<<p[i];
        }
    }
    else while(k--)  for(int i=0; i<n; i++)cout<<p[i];
    cout<<endl;
    //main();
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,l;
  cin>>n>>k;
  char s[10000];
  cin>>s;
  while(k--)cout<<s;
  cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,n,l,p=0;
    cin>>n>>k;
    string s;
    cin>>s;
    if(s.size()>1) {
        i=0;
        j=i+1;
        while(1)
        {
            if(s[i]!=s[j]) {
                while(s[i]!=s[j])
                {   j++;
                    if(j==s.size())break;
                }
                if(j==s.size())break;
                p=j-1;
            }
            else
                if(s[i]==s[j])  while(s[i]==s[j])
                    {
                        i++;
                        j++;
                        if(j==s.size() || i==s.size())break;
                    }
            break;
        }

    if(p!=0 )
    {
        while(k--)  for(i=0; i<=p; i++)cout<<s[i];
        for(i=0; i<=p-1; i++)cout<<s[i];
    }
    else
        if(s[0]==s[n-1])
        {
            cout<<s;
            l=k-1;
            while(l--)
            {
                for(i=1; i<s.size(); i++)cout<<s[i];
            }
        }
        else
            while(k--)  for(i=0; i<s.size(); i++)cout<<s[i];
      }
        else
            while(k--)  for(i=0; i<s.size(); i++)cout<<s[i];
    cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
vector<int >prefix;
vector<int >position ;
string p;
void compute_prefix()
{
    long long m=p.size();
    prefix.push_back(0);
    long long i=1,len=0;
    while(i<m)
    {
        if(p[i]==p[len])
        {
            len++;
            prefix.push_back(len);
            i++;
        }
        else
        {
            if(len!=0)
            {
                len=prefix[len-1];
            }
            else
            {
                prefix.push_back(0);
                i++;
            }
        }
    }
}
int main()
{
    int n,k,l,m,j,t,q;
    cin>>n>>k;
    cin>>p;
    compute_prefix();
    m=prefix.size();
    if(prefix[m-1]!=0) {
        t=prefix[m-1]-1;
        q=n-1-prefix[m-1];
        if(t<n && q>0)
        {
            while(k--)for(int i=0; i<=q; i++)cout<<p[i];
            for(int i=0; i<=t; i++)cout<<p[i];
        }
        else
        {
            if(n<=k)
            {
                k--;
                while(k--)  for(int i=1; i<=n-1; i++)cout<<p[0];
                cout<<p[0];
            }
            else while(k--)  for(int i=0; i<n; i++)cout<<p[i];
        }
    }
    else while(k--)  for(int i=0; i<n; i++)cout<<p[i];
    cout<<endl;
    //main();
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,l,p;
  cin>>n>>k;
string s;
cin>>s;
i=0;
j=i+1;
while(1)
{
  if(s[i]!=s[j])
  while(s[i]!=s[j])
    j++;

  p=j-1;
   if(s[i]==s[j])  while(s[i]==s[j])
  {

    i++;
    j++;

  }
  break;

}
if(j==s.size())
{
while(k--)  for(i=0;i<=p;i++)cout<<s[i];
for(i=0;i<=p-1;i++)cout<<s[i];
}
else
while(k--)  for(i=0;i<s.size();i++)cout<<s[i];
  cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,l;
  cin>>n>>k;
  char s[n];
  cin>>s;
  if(strlen(s)==1)while(k--)for(i=0;i<strlen(s);i++)cout<<s[i];
else   if(s[0]==s[n-1])
  {
    cout<<s;
    l=k-1;
    while(l--)
    {
      for(i=1;i<strlen(s);i++)cout<<s[i];
    }
  }
  else
  while(k--)cout<<s;

  cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,n,l,p=0;
    cin>>n>>k;
    string s;
    cin>>s;
    if(s.size()>1) {
        i=0;
        j=i+1;
        while(1)
        {
            if(s[i]!=s[j]) {
                while(s[i]!=s[j])
                {   j++;
                    if(j==s.size())break;
                }
                if(j==s.size())break;
                p=j-1;
            }
            else
                if(s[i]==s[j])  while(s[i]==s[j])
                    {
                        i++;
                        j++;
                        if(j==s.size() || i==s.size())break;
                    }
            break;
        }

    if(p!=0 )
    {
        while(k--)  for(i=0; i<=p; i++)cout<<s[i];
        for(i=0; i<=p-1; i++)cout<<s[i];
    }
    else
        if(s[0]==s[n-1])
        {
            cout<<s;
            l=k-1;
            while(l--)
            {
                for(i=1; i<s.size(); i++)cout<<s[i];
            }
        }
        else
            while(k--)  for(i=0; i<s.size(); i++)cout<<s[i];
      }
        else
            while(k--)  for(i=0; i<s.size(); i++)cout<<s[i];
    cout<<endl;
    main();
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,l;
  cin>>n>>k;
  char s[n];
  cin>>s;
  if(s[0]==s[n-1])
  {
    cout<<s;
    l=k-1;
    while(l--)
    {
      for(i=1;i<strlen(s);i++)cout<<s[i];
    }
  }
  else
  while(k--)cout<<s;

  cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,l;
  cin>>n>>k;
string s;
  cin>>s;
  if(s.size()==1)while(k--)for(i=0;i<s.size();i++)cout<<s[i];
else   if(s[0]==s[n-1])
  {
    cout<<s;
    l=k-1;
    while(l--)
    {
      for(i=1;i<s.size();i++)cout<<s[i];
    }

  }
  else
  while(k--)cout<<s;

  cout<<endl;

}


#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define DEBUG(x) cout << ">> " << #x << " : " << x << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;

int main()
{
    //freopen("input.txt", "r", stdin);
    ll n, k;
    cin >> n >> k;
    string t;
    cin >> t;
    ll pos = n;
    FOR(i, 1, n)
    {
        string l = string(t.begin() + i, t.end());

        string r = string(t.begin(), t.end() - i);
        if (l == r)
        {
            pos = i;
        }
    }
    string s;
    //DEBUG(pos)
    FOR(i, 0, k)
    {
        FOR(j, 0, pos)
        {
            s += t[j];
        }
    }
    s += t.substr(pos);
    cout << s;
}


#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define DEBUG(x) cout << ">> " << #x << " : " << x << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;

int main()
{
    //freopen("input.txt", "r", stdin);
    ll n, k;
    cin >> n >> k;
    string t;
    cin >> t;
    ll pos = n;
    FOR(i, 0, n)
    {
        string l = t.substr(0, i + 1);

        string r = t.substr(n - 1 - i, i + 1);
       // DEBUG(r)
        if (i <= n - 1 - i && l == r)
        {
            pos = n - 1- i;
        //DEBUG(pos);
        }
    }
    string s;
    FOR(i ,0 ,k)
    {
        FOR(j, 0, pos)
        {
            s += t[j];
        }
    }
    s += t.substr(pos, n - pos);
    cout << s;
}


#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define DEBUG(x) cout << ">> " << #x << " : " << x << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;

int main()
{
//    freopen("input.txt", "r", stdin);
    ll n, k;
    cin >> n >> k;
    string t;
    cin >> t;
    ll pos = n;
    FOR(i, 0, n)
    {
        string l = t.substr(0, i + 1);

        string r = t.substr(n - 1 - i, i + 1);

        if (i <= n - 1 - i && l == r)
        {
            pos = min(pos, n - 1- i);
      //  DEBUG(n - 1- i);
        }
    }
    string s;
    if (pos == 0)
        pos = n;
    FOR(i ,0 ,k)
    {
        FOR(j, 0, pos)
        {
                s += t[j];
        }
    }

    s += t.substr(pos, n - pos);
    cout << s;
}


#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define DEBUG(x) cout << ">> " << #x << " : " << x << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;

int main()
{
    //freopen("input.txt", "r", stdin);
    ll n, k;
    cin >> n >> k;
    string t;
    cin >> t;
    ll pos = 0;
    FOR(i, 0, n)
    {
        string l = t.substr(0, i + 1);

        string r = t.substr(n - 1 - i, i + 1);
       // DEBUG(r)
        if (l != r)
        {
            pos = n - 1- i;
         //   DEBUG(pos)
            break;
        }
    }
    string s;
    FOR(i ,0 ,k)
    {
        FOR(j, 0, pos + 1)
        {
            s += t[j];
        }
    }
    s += t.substr(pos + 1, n - pos - 1);
    cout << s;
}


#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define DEBUG(x) cout << ">> " << #x << " : " << x << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;

int main()
{
  //  freopen("input.txt", "r", stdin);
    ll n, k;
    cin >> n >> k;
    string t;
    cin >> t; ;
    ll pos = n;
    FOR(i, 1, n)
    {
        string l = string(t.begin() + i, t.end());

        string r = string(t.begin(), t.end() - i);
        if (l == r)
        {
            pos = i;
            break;
        }
    }
    string s;
    //DEBUG(pos)
    FOR(i, 0, k)
    {
        FOR(j, 0, pos)
        {
            s += t[j];
        }
    }
    s += t.substr(pos);
    cout << s;
}


#include <bits/stdc++.h>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define DEBUG(x) cout << ">> " << #x << " : " << x << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;

int main()
{
    //freopen("input.txt", "r", stdin);
    ll n, k;
    cin >> n >> k;
    string t;
    cin >> t;
    ll pos = n;
    FOR(i, 1, n)
    {
        string l = string(t.begin() + i, t.end());

        string r = string(t.begin(), t.end() - i);
        if (l == r)
        {
            pos = i;
            break;
        }
    }
    string s;
    //DEBUG(pos)
    FOR(i, 0, k)
    {
        FOR(j, 0, pos)
        {
            s += t[j];
        }
    }
    s += t.substr(pos);
    cout << s;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, k;
    while(scanf("%d %d", &n, &k) == 2){
        char x[n+2];
        scanf("%s", x);
        char first = x[0];
        int pos = 0;
        for(int i = 1; i < n; i++){
            if(x[i] == first) pos = i;
        }
        int repeat = n - pos;
        if(pos == 0) repeat = 0;
        printf("%s", x);
        for(int i = 1; i <= k-1; i++){
            for(int p = repeat; p < n; p++){
                printf("%c", x[p]);
            }
        }
        printf("\n");
    }
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, k;
while(cin >> n >> k){
    string str;
    cin >> str;

    string uniq = "";
    string toadd = "";

    int pos = 0;
    uniq += str[pos];

    for(int i = 1; i < n; i++){
        if(str[i] == str[0]){pos = i; break;}
        uniq += str[i];
    }

    //cout << "uniq = " << uniq << endl;

    int len = uniq.length();

    bool newuniqlagbe = true;

    int i, j;
    for(i = 0, j = 0; i < n; i++, j++){
        if(j == len) j = 0;
        if(str[i] != uniq[j]){newuniqlagbe = false; break;}
    }
    //if(j == len) newuniqlagbe = false;

    if(pos == 0) newuniqlagbe = false;

    if(newuniqlagbe){
        for(int p = j; p < len; p++) toadd += uniq[p];
        for(int p = 0; p < j; p++) toadd += uniq[p];
    }

    cout << str;
    if(newuniqlagbe) for(int ll = 2; ll <= k; ll++) cout << toadd;
    else for(int ll = 2; ll <= k; ll++) cout << str;
    cout << endl;
}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, k;
    while(scanf("%d %d", &n, &k) == 2){
        char x[n+2];
        scanf("%s", x);
        char first = x[0];
        int pos = 0;
        for(int i = 1; i < n; i++){
            if(x[i] == first) {pos = i; break;}
        }
        int repeat = n - pos;
        if(pos == 0) repeat = 0;
        printf("%s", x);
        for(int i = 1; i <= k-1; i++){
            for(int p = repeat; p < n; p++){
                printf("%c", x[p]);
            }
        }
        printf("\n");
    }
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, k;

    while(cin >> n >> k){
        string str;
        cin >> str;
        int len = str.length();

        string init = "nai", toadd = "", ans = "";
        for(int i = 0; i < len-1; i++){
            string fwd = "", bwd = "";
            for(int f = 0; f <= i; f++) fwd += str[f];
            for(int b = len-1-i; b < len; b++) bwd += str[b];
            if(fwd == bwd) init = fwd;
        }

        if(init == "nai"){
            for(int i = 1; i <= k; i++) ans += str;
        }
        else{
            ans += init;
            for(int i = init.length(); i < len; i++) toadd += str[i];
            for(int i = 1; i <= k; i++) ans += toadd;
        }

        cout << ans << endl;
    } ///C
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, k;
while(cin >> n >> k){
    string str;
    cin >> str;

    string uniq = "";
    string toadd = "";

    int pos = 0;
    uniq += str[pos];

    for(int i = 1; i < n; i++){
        if(str[i+1] == str[0] && str[i] == str[0]) {uniq += str[i]; pos = i+1; break;}
        if(str[i] == str[0]){pos = i; break;}
        uniq += str[i];
    }

    //cout << "uniq = " << uniq << endl;

    int len = uniq.length();

    bool newuniqlagbe = true;

    int i, j;
    for(i = 0, j = 0; i < n; i++, j++){
        if(j == len) j = 0;
        if(str[i] != uniq[j]){newuniqlagbe = false; break;}
    }
    //if(j == len) newuniqlagbe = false;

    if(pos == 0) newuniqlagbe = false;

    if(newuniqlagbe){
        for(int p = j; p < len; p++) toadd += uniq[p];
        for(int p = 0; p < j; p++) toadd += uniq[p];
    }

    cout << str;
    if(newuniqlagbe) for(int ll = 2; ll <= k; ll++) cout << toadd;
    else for(int ll = 2; ll <= k; ll++) cout << str;
    cout << endl;
}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    string str;
    cin >> str;

    string uniq = "";
    string toadd = "";

    int pos = 0;
    uniq += str[pos];

    for(int i = 1; i < n; i++){
        if(str[i] == str[0]){pos = i; break;}
        uniq += str[i];
    }

    //cout << "uniq = " << uniq << endl;

    int len = uniq.length();

    bool newuniqlagbe = true;

    int i, j;
    for(i = 0, j = 0; i < n; i++, j++){
        if(j == len) j = 0;
        if(str[i] != uniq[j]){newuniqlagbe = false; break;}
    }
    if(j == len) newuniqlagbe = false;

    if(pos == 0) newuniqlagbe = false;

    if(newuniqlagbe){
        for(int p = j; p < len; p++) toadd += uniq[p];
        for(int p = 0; p < j; p++) toadd += uniq[p];
    }

    cout << str;
    if(newuniqlagbe) for(int ll = 2; ll <= k; ll++) cout << toadd;
    else for(int ll = 2; ll <= k; ll++) cout << uniq;
    cout << endl;
}


#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, k;
    while(scanf("%d %d", &n, &k) == 2){
        char str[n+2];
        scanf("%s", str);

        int pos = 0;
        for(int i = 1; i < n; i++){
            if(str[i] == str[0]) {pos = i; break;}
        }

        int purotaprefix = 1;
        if(pos == 0) purotaprefix = 0;

        if(pos != 0){

            int i, j;
            for(i = pos, j = 0; i < n && j < pos; i++, j++){
                if(str[i] != str[j]){purotaprefix = 0; break;}
            }
            if(i != n) purotaprefix = 0;
        }

        if(purotaprefix){
            printf("%s", str);
            for(int i = 1; i < k; i++){
                for(int p = (n-pos); p < n; p++){
                    printf("%c", str[p]);
                }
            }
            printf("\n");
        }

        else{
            for(int i = 1; i <= k; i++) printf("%s", str);
            printf("\n");
        }
    } ///Case

    return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

for(i=0;i<n;i++)
  if(ss.substr(0,i)==ss.substr(n-i,i))
   r=i;

//cout<<r;

rep(j,k-1)cout<<ss.substr(0,n-r);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

for(i=1;i<n;i++){
  if(ss.substr(0,i)==ss.substr(n-i,i));
    break;
}

rep(j,k-1)cout<<ss.substr(0,n-i);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

for(i=0;i<=n/2;i++){
  if(ss.substr(0,i)==ss.substr(n-i,i));
  r=i;
}
//cout<<r;

cout<<r;

rep(j,k-1)cout<<ss.substr(0,n-r);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

for(i=0;i<=n/2;i++){
  if(ss.substr(0,i)==ss.substr(n-i,i));
  r=i;
}
//cout<<r;

rep(j,k-1)cout<<ss.substr(0,n-r);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

for(i=0;i<n/2;i++){
  if(ss.substr(0,i+1)==ss.substr(n-i-1,i+1));
  r=i;
}
//cout<<r;

rep(j,k-1)cout<<ss.substr(0,n-r-1);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

for(i=0;i<n;i++){
  if(ss.substr(0,i)==ss.substr(n-i,i));
    break;
}

rep(j,k-1)cout<<ss.substr(0,n-i);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

r=-1;
for(i=0;i<n/2;i++){
  if(ss.substr(0,i+1)==ss.substr(n-i-1,i+1));
  r=i;
}
cout<<r;

rep(j,k-1)cout<<ss.substr(0,n-r-1);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

for(i=0;i<=n/2;i++)
  if(ss.substr(0,i)==ss.substr(n-i,i))
   r=i;

//cout<<r;

rep(j,k-1)cout<<ss.substr(0,n-r);
cout<<ss;

return 0;
}


 #include<bits/stdc++.h>
using namespace std;
#define ll   long long
#define pb push_back
 //#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fr first
#define sc second
#define memset(a, b) memset(a, b, sizeof(a))
#define PI 3.1415926535897932384626
#define lcm(a,b) ((a)*(b))/(__gcd((a),(b)))
#define gcd(a,b) __gcd((a),(b))
#define mod 1e9+7
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)

// bool bb[2000003];
   ll d,ct=0,q=0,l=0,n=0,k=0,m=0,i,x=0,mn=0,y=0,z=0,j=0,s=0,r=0;
     pair<ll,ll>p[300003];
   int t; char ch,che;
    string ss="",str="" ;
    set<pair<ll,ll>>stt; set<ll>st;
   //  unordered_map<pair<<ll,ll>,ll>mpp;
   //  map<pair<ll,ll>mp;

  // ll arr[200003]={0},c[200003];
   ll a[200003],b[200003];

  double dr;

 int main(){

 ios_base::sync_with_stdio(false),
    cin.tie(nullptr),cout.tie(nullptr);

  //  cin>>t; while(t--) {
 //  vector<int>vec(200003),v(200003);
  //  st.clear();
      //   mp.clear();  // mpp.clear();
  //  memset(bb,0) ; // memset(a,0);

         s=k=d=l=m=r=q=i=x=j=y=z=mn=0;  ss="";str="";

string s1="",s2="";
cin>>n>>k;
cin>>ss;str=ss;

r=-1;
for(i=0;i<n/2;i++){
  if(ss.substr(0,i+1)==ss.substr(n-i-1,i+1));
  r=i;
}
//cout<<r;

rep(j,k-1)cout<<ss.substr(0,n-r-1);
cout<<ss;

return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	fr(i,1,n/2+1){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	cout<<l;
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		fr(i,1,k-1)
			cout<<s.substr(0,n-l);
		cout<<s;
	}

	return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	fr(i,1,ceil(n/2)){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		fr(i,1,k-1)
			cout<<s.substr(0,n-l);
		cout<<s;
	}

	return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	if(n==1)
		return ans;
	rep(i,1,n){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		fr(i,1,k-1)
			cout<<s.substr(0,n-l);
		cout<<s;
	}

	return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	fr(i,1,ceil((float)n/2)){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		fr(i,1,k-1)
			cout<<s.substr(0,n-l);
		cout<<s;
	}

	return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	fr(i,1,n/2+1){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		fr(i,1,k-1)
			cout<<s.substr(0,n-l);
		cout<<s;
	}

	return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	if(n==1)
		return ans;
	fr(i,1,ceil((float)n/2)){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		fr(i,1,k-1)
			cout<<s.substr(0,n-l);
		cout<<s;
	}

	return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	fr(i,1,n/2+1){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		cout<<s;
		fr(i,1,k-1)
			cout<<s.substr(l,n-l);

	}

	return 0;
}


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

#define endl		'\n'
#define w(t)		int t;cin>>t;while(t--)
#define int			long long
#define fr(i,a,b)	for(int i=a;i<=b;i++)
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define pb 			push_back
#define ppb			pop_back
#define mp			make_pair
#define all(x)		x.begin(),x.end()
#define ff			first
#define ss			second
#define pii			pair<int,int>
#define vi			vector<int>
#define vvi			vector<vi>
#define pqi			priority_queue<int>
#define pqd			priority_queue<int,vi,greater<int>>
#define inf			LLONG_MAX
#define mod			1000000007

int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}
int lcm(int a,int b){ return a*b/gcd(a,b);}

int len(string s){

	int n=s.length();
	int ans=inf;
	fr(i,1,n/2){
		if(s.substr(0,i)==s.substr(n-i,i))
			ans=i;
	}
	return ans;
}

int32_t main(){

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

	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;

	int l=len(s);
	if(l==inf){
		fr(i,1,k)
			cout<<s;
	}
	else{
		fr(i,1,k-1)
			cout<<s.substr(0,n-l);
		cout<<s;
	}

	return 0;
}


#include <bits/stdc++.h>
#define CS  ios_base::sync_with_stdio(false);cin.tie();
#define PI  3.141592653589793238462643383279502884
#define Max 100005
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define Mod 100000000
#define inc(i,a,b) for(ll (i)=(a);(i)<(b);++(i))
#define ince(i,a,b) for(ll (i)=(a);(i)<=(b);++(i))
#define dec(i,a,b) for(ll (i)=(a);(i)>=(b);--(i))
#define max_el(x) max_element(x.begin(),x.end())
#define min_el(x) min_element(x.begin(),x.end())
#define nl "\n"
#define F    first
#define S    second
#define pb   push_back
#define pr  pair<int,int>

using namespace std;
int rnk[1001];
int parnt[1001];
bool prim[100001];
void seive()
{
    prim[0]=prim[1]=1;
    for(ull i=2;i<100001;i++)
    {
        if(prim[i]==0)
        {
            for(ull j=i*i;j<100001;j+=i)prim[j]=1;
        }
    }
}
int findparnt(int x)
{
    if(parnt[x]==x)return x;
    return parnt[x]=findparnt(parnt[x]);
}
bool iscon(int x,int y)
{
    return (findparnt(x)==findparnt(y));
}
void conn(int x,int y)
{
    int px=findparnt(x);
    int py=findparnt(y);
    if(px==py)return;
    if(rnk[px]>rnk[py])
    {
        parnt[py]=px;
    }
    else if(rnk[px]<rnk[py])
    {
        parnt[px]=py;
    }
    else
    {
        rnk[px]++;
        parnt[py]=px;
    }
}
ll gcd(ll x,ll y)
{
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ull fastpow(ull b,ull p)
{
    if(p==0)return 1;
    ull t=fastpow(b,p/2);
    if(p%2==0)return t*t;
    return t*t*b;
}
ull lcm(ull a, ull b)
{
    return ((a*b)/gcd(a,b));
}
double dis(double x,double y,double x1,double y1)
{
    return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main()
{
    CS
//freopen("input.TXT","r",stdin);
//freopen("output.TXT","w",stdout);
int a,b;
cin>>a>>b;
string s;
cin>>s;
int f=0;

for(int i=a-1;i>=a/2;i--)
{
    string r;
   for(int j=i;j<a;j++)r+=s[j];
   if(s.find(r)!=0)break;
   f=r.size();
}
if(s.size()==1)f=0;
string k;
for(f;f<s.size();f++)k+=s[f];
cout<<s;
inc(e,0,b-1)cout<<k;

}


#include <bits/stdc++.h>
#define CS  ios_base::sync_with_stdio(false);cin.tie();
#define PI  3.141592653589793238462643383279502884
#define Max 100005
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define Mod 100000000
#define inc(i,a,b) for(ll (i)=(a);(i)<(b);++(i))
#define ince(i,a,b) for(ll (i)=(a);(i)<=(b);++(i))
#define dec(i,a,b) for(ll (i)=(a);(i)>=(b);--(i))
#define max_el(x) max_element(x.begin(),x.end())
#define min_el(x) min_element(x.begin(),x.end())
#define nl "\n"
#define F    first
#define S    second
#define pb   push_back
#define pr  pair<int,int>

using namespace std;
int rnk[1001];
int parnt[1001];
bool prim[100001];
void seive()
{
    prim[0]=prim[1]=1;
    for(ull i=2;i<100001;i++)
    {
        if(prim[i]==0)
        {
            for(ull j=i*i;j<100001;j+=i)prim[j]=1;
        }
    }
}
int findparnt(int x)
{
    if(parnt[x]==x)return x;
    return parnt[x]=findparnt(parnt[x]);
}
bool iscon(int x,int y)
{
    return (findparnt(x)==findparnt(y));
}
void conn(int x,int y)
{
    int px=findparnt(x);
    int py=findparnt(y);
    if(px==py)return;
    if(rnk[px]>rnk[py])
    {
        parnt[py]=px;
    }
    else if(rnk[px]<rnk[py])
    {
        parnt[px]=py;
    }
    else
    {
        rnk[px]++;
        parnt[py]=px;
    }
}
ll gcd(ll x,ll y)
{
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ull fastpow(ull b,ull p)
{
    if(p==0)return 1;
    ull t=fastpow(b,p/2);
    if(p%2==0)return t*t;
    return t*t*b;
}
ull lcm(ull a, ull b)
{
    return ((a*b)/gcd(a,b));
}
double dis(double x,double y,double x1,double y1)
{
    return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main()
{
    CS
//freopen("input.TXT","r",stdin);
//freopen("output.TXT","w",stdout);
int a,b;
cin>>a>>b;
string s;
cin>>s;
int j=a-1,i=0;
while(i<j)
{
    if(s[i]!=s[j])break;
    i++,j--;
}
string k;
for(i;i<s.size();i++)k+=s[i];
cout<<s;
inc(e,0,b-1)cout<<k;

}


#include <bits/stdc++.h>
#define CS  ios_base::sync_with_stdio(false);cin.tie();
#define PI  3.141592653589793238462643383279502884
#define Max 100005
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define Mod 100000000
#define inc(i,a,b) for(ll (i)=(a);(i)<(b);++(i))
#define ince(i,a,b) for(ll (i)=(a);(i)<=(b);++(i))
#define dec(i,a,b) for(ll (i)=(a);(i)>=(b);--(i))
#define max_el(x) max_element(x.begin(),x.end())
#define min_el(x) min_element(x.begin(),x.end())
#define nl "\n"
#define F    first
#define S    second
#define pb   push_back
#define pr  pair<int,int>

using namespace std;
int rnk[1001];
int parnt[1001];
bool prim[100001];
void seive()
{
    prim[0]=prim[1]=1;
    for(ull i=2;i<100001;i++)
    {
        if(prim[i]==0)
        {
            for(ull j=i*i;j<100001;j+=i)prim[j]=1;
        }
    }
}
int findparnt(int x)
{
    if(parnt[x]==x)return x;
    return parnt[x]=findparnt(parnt[x]);
}
bool iscon(int x,int y)
{
    return (findparnt(x)==findparnt(y));
}
void conn(int x,int y)
{
    int px=findparnt(x);
    int py=findparnt(y);
    if(px==py)return;
    if(rnk[px]>rnk[py])
    {
        parnt[py]=px;
    }
    else if(rnk[px]<rnk[py])
    {
        parnt[px]=py;
    }
    else
    {
        rnk[px]++;
        parnt[py]=px;
    }
}
ll gcd(ll x,ll y)
{
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ull fastpow(ull b,ull p)
{
    if(p==0)return 1;
    ull t=fastpow(b,p/2);
    if(p%2==0)return t*t;
    return t*t*b;
}
ull lcm(ull a, ull b)
{
    return ((a*b)/gcd(a,b));
}
double dis(double x,double y,double x1,double y1)
{
    return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main()
{
    CS
//freopen("input.TXT","r",stdin);
//freopen("output.TXT","w",stdout);
int a,b;
cin>>a>>b;
string s;
cin>>s;
int f=0;

for(int i=a-1;i>0;i--)
{
    string r;
   for(int j=i;j<a;j++)r+=s[j];
   if(s.find(r)==0)f=r.size();;
}

string k;
for(f;f<s.size();f++)k+=s[f];
cout<<s;
inc(e,0,b-1)cout<<k;

}


#include <bits/stdc++.h>
#define CS  ios_base::sync_with_stdio(false);cin.tie();
#define PI  3.141592653589793238462643383279502884
#define Max 100005
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define Mod 100000000
#define inc(i,a,b) for(ll (i)=(a);(i)<(b);++(i))
#define ince(i,a,b) for(ll (i)=(a);(i)<=(b);++(i))
#define dec(i,a,b) for(ll (i)=(a);(i)>=(b);--(i))
#define max_el(x) max_element(x.begin(),x.end())
#define min_el(x) min_element(x.begin(),x.end())
#define nl "\n"
#define F    first
#define S    second
#define pb   push_back
#define pr  pair<int,int>

using namespace std;
int rnk[1001];
int parnt[1001];
bool prim[100001];
void seive()
{
    prim[0]=prim[1]=1;
    for(ull i=2;i<100001;i++)
    {
        if(prim[i]==0)
        {
            for(ull j=i*i;j<100001;j+=i)prim[j]=1;
        }
    }
}
int findparnt(int x)
{
    if(parnt[x]==x)return x;
    return parnt[x]=findparnt(parnt[x]);
}
bool iscon(int x,int y)
{
    return (findparnt(x)==findparnt(y));
}
void conn(int x,int y)
{
    int px=findparnt(x);
    int py=findparnt(y);
    if(px==py)return;
    if(rnk[px]>rnk[py])
    {
        parnt[py]=px;
    }
    else if(rnk[px]<rnk[py])
    {
        parnt[px]=py;
    }
    else
    {
        rnk[px]++;
        parnt[py]=px;
    }
}
ll gcd(ll x,ll y)
{
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ull fastpow(ull b,ull p)
{
    if(p==0)return 1;
    ull t=fastpow(b,p/2);
    if(p%2==0)return t*t;
    return t*t*b;
}
ull lcm(ull a, ull b)
{
    return ((a*b)/gcd(a,b));
}
double dis(double x,double y,double x1,double y1)
{
    return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main()
{
    CS
//freopen("input.TXT","r",stdin);
//freopen("output.TXT","w",stdout);
int a,b;
cin>>a>>b;
string s;
cin>>s;
int f=0;
for(int i=a-1;i>=a/2;i--)
{
    int e=0,j=i;
    for(;j<a;j++)
    {
        if(s[e]!=s[j])break;
        e++;
    }
    if(j==a)f=e;
    else break;
}
if(s.size()==1)f=0;
string k;
for(f;f<s.size();f++)k+=s[f];
cout<<s;
inc(e,0,b-1)cout<<k;

}


#include <bits/stdc++.h>
#define CS  ios_base::sync_with_stdio(false);cin.tie();
#define PI  3.141592653589793238462643383279502884
#define Max 100005
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define Mod 100000000
#define inc(i,a,b) for(ll (i)=(a);(i)<(b);++(i))
#define ince(i,a,b) for(ll (i)=(a);(i)<=(b);++(i))
#define dec(i,a,b) for(ll (i)=(a);(i)>=(b);--(i))
#define max_el(x) max_element(x.begin(),x.end())
#define min_el(x) min_element(x.begin(),x.end())
#define nl "\n"
#define F    first
#define S    second
#define pb   push_back
#define pr  pair<int,int>

using namespace std;
int rnk[1001];
int parnt[1001];
bool prim[100001];
void seive()
{
    prim[0]=prim[1]=1;
    for(ull i=2;i<100001;i++)
    {
        if(prim[i]==0)
        {
            for(ull j=i*i;j<100001;j+=i)prim[j]=1;
        }
    }
}
int findparnt(int x)
{
    if(parnt[x]==x)return x;
    return parnt[x]=findparnt(parnt[x]);
}
bool iscon(int x,int y)
{
    return (findparnt(x)==findparnt(y));
}
void conn(int x,int y)
{
    int px=findparnt(x);
    int py=findparnt(y);
    if(px==py)return;
    if(rnk[px]>rnk[py])
    {
        parnt[py]=px;
    }
    else if(rnk[px]<rnk[py])
    {
        parnt[px]=py;
    }
    else
    {
        rnk[px]++;
        parnt[py]=px;
    }
}
ll gcd(ll x,ll y)
{
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ull fastpow(ull b,ull p)
{
    if(p==0)return 1;
    ull t=fastpow(b,p/2);
    if(p%2==0)return t*t;
    return t*t*b;
}
ull lcm(ull a, ull b)
{
    return ((a*b)/gcd(a,b));
}
double dis(double x,double y,double x1,double y1)
{
    return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main()
{
    CS
//freopen("input.TXT","r",stdin);
//freopen("output.TXT","w",stdout);
int a,b;
cin>>a>>b;
string s;
cin>>s;
int f=0;

for(int i=a-1;i>=0;i--)
{
    string r;
   for(int j=i;j<a;j++)r+=s[j];
   if(s.find(r)!=0)break;
   f=r.size();
}
if(s.size()==1)f=0;
string k;
for(f;f<s.size();f++)k+=s[f];
cout<<s;
inc(e,0,b-1)cout<<k;

}


#include <bits/stdc++.h>
#define CS  ios_base::sync_with_stdio(false);cin.tie();
#define PI  3.141592653589793238462643383279502884
#define Max 100005
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define Mod 100000000
#define inc(i,a,b) for(ll (i)=(a);(i)<(b);++(i))
#define ince(i,a,b) for(ll (i)=(a);(i)<=(b);++(i))
#define dec(i,a,b) for(ll (i)=(a);(i)>=(b);--(i))
#define max_el(x) max_element(x.begin(),x.end())
#define min_el(x) min_element(x.begin(),x.end())
#define nl "\n"
#define F    first
#define S    second
#define pb   push_back
#define pr  pair<int,int>

using namespace std;
int rnk[1001];
int parnt[1001];
bool prim[100001];
void seive()
{
    prim[0]=prim[1]=1;
    for(ull i=2;i<100001;i++)
    {
        if(prim[i]==0)
        {
            for(ull j=i*i;j<100001;j+=i)prim[j]=1;
        }
    }
}
int findparnt(int x)
{
    if(parnt[x]==x)return x;
    return parnt[x]=findparnt(parnt[x]);
}
bool iscon(int x,int y)
{
    return (findparnt(x)==findparnt(y));
}
void conn(int x,int y)
{
    int px=findparnt(x);
    int py=findparnt(y);
    if(px==py)return;
    if(rnk[px]>rnk[py])
    {
        parnt[py]=px;
    }
    else if(rnk[px]<rnk[py])
    {
        parnt[px]=py;
    }
    else
    {
        rnk[px]++;
        parnt[py]=px;
    }
}
ll gcd(ll x,ll y)
{
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ull fastpow(ull b,ull p)
{
    if(p==0)return 1;
    ull t=fastpow(b,p/2);
    if(p%2==0)return t*t;
    return t*t*b;
}
ull lcm(ull a, ull b)
{
    return ((a*b)/gcd(a,b));
}
double dis(double x,double y,double x1,double y1)
{
    return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main()
{
    CS
//freopen("input.TXT","r",stdin);
//freopen("output.TXT","w",stdout);
int a,b;
cin>>a>>b;
string s;
cin>>s;
int f=0;
for(int i=a-1;i>=a/2;i--)
{
    int e=0,j=i;
    for(;j<a;j++)
    {
        if(s[e]!=s[j])break;
        e++;
    }
    if(j==a)f=e;
    else break;
}
string k;
for(f;f<s.size();f++)k+=s[f];
cout<<s;
inc(e,0,b-1)cout<<k;

}


#include <bits/stdc++.h>
#define CS  ios_base::sync_with_stdio(false);cin.tie();
#define PI  3.141592653589793238462643383279502884
#define Max 100005
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define Mod 100000000
#define inc(i,a,b) for(ll (i)=(a);(i)<(b);++(i))
#define ince(i,a,b) for(ll (i)=(a);(i)<=(b);++(i))
#define dec(i,a,b) for(ll (i)=(a);(i)>=(b);--(i))
#define max_el(x) max_element(x.begin(),x.end())
#define min_el(x) min_element(x.begin(),x.end())
#define nl "\n"
#define F    first
#define S    second
#define pb   push_back
#define pr  pair<int,int>

using namespace std;
int rnk[1001];
int parnt[1001];
bool prim[100001];
void seive()
{
    prim[0]=prim[1]=1;
    for(ull i=2;i<100001;i++)
    {
        if(prim[i]==0)
        {
            for(ull j=i*i;j<100001;j+=i)prim[j]=1;
        }
    }
}
int findparnt(int x)
{
    if(parnt[x]==x)return x;
    return parnt[x]=findparnt(parnt[x]);
}
bool iscon(int x,int y)
{
    return (findparnt(x)==findparnt(y));
}
void conn(int x,int y)
{
    int px=findparnt(x);
    int py=findparnt(y);
    if(px==py)return;
    if(rnk[px]>rnk[py])
    {
        parnt[py]=px;
    }
    else if(rnk[px]<rnk[py])
    {
        parnt[px]=py;
    }
    else
    {
        rnk[px]++;
        parnt[py]=px;
    }
}
ll gcd(ll x,ll y)
{
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ull fastpow(ull b,ull p)
{
    if(p==0)return 1;
    ull t=fastpow(b,p/2);
    if(p%2==0)return t*t;
    return t*t*b;
}
ull lcm(ull a, ull b)
{
    return ((a*b)/gcd(a,b));
}
double dis(double x,double y,double x1,double y1)
{
    return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main()
{
    CS
//freopen("input.TXT","r",stdin);
//freopen("output.TXT","w",stdout);
int a,b;
cin>>a>>b;
string s;
cin>>s;
int j=a-1,i=0;
while(i<j)
{
    if(s[i]!=s[j])break;
    i++,j--;
}
if(i>j&&a%2==0)i--;
string k;
for(i;i<s.size();i++)k+=s[i];
cout<<s;
inc(e,0,b-1)cout<<k;

}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> //for less
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define m_p make_pair
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define double long double
const double pi=3.14159265358979;
const   int  mod=1e9+7;
int takemod(int a){return ((a%mod)+mod)%mod;}
typedef  tree < int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;

signed main()
{
	ios
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1)
    {
    	k--;
    	while(k--)s+=s[0];
    	cout<<s;
    	return 0;
    }
    int i=0;
    int j=n-1;
    int flag=0;
    int foo=0;
    string h1="",h2="",h4="",h5="";

    while(j>i)
    {
    	h1+=s[i];
    	h2+=s[j];
    	string h3=h2;
    	//cout<<h1<<" "<<h2<<endl;
    	reverse(h3.begin(),h3.end());
    	if(h3==h1)
    		{
    			foo=1;
    			break;
    		}
    	i++;
    	j--;

    }

    i++;
    int  k1 = n/(h1.size());
    set<string> st;
    if(foo==1 and n%h1.size()==0)
    {
       int t=k1-2;
       while(t--)
       	{
       		st.insert(s.substr(i,h1.size()));
       		 i+=h1.size();
       	}

    }
    set<string> :: iterator itr;
    itr=st.begin();
    if((st.size()==1 and *itr==h1 and foo==1) or (foo==1 and k1==2 and n==2*h1.size()))flag=1;
    //cout<<flag<<endl;
    if(flag==1)
    {
    	k--;
    	while(k--)s+=h1;
    	cout<<s;
    	return 0;
    }
        string ans="";
        foo=0;
        j=n-1;
        i=0;
        h1="";

        h2="";
    while(j>i)
    {
    	h1+=s[i];
    	h2+=s[j];
    	string h3=h2;
    	//cout<<h1<<" "<<h2<<endl;
    	reverse(h3.begin(),h3.end());
    	if(h3==h1)
    		{
    			foo=1;
    			ans=h1;
    		}
    	i++;
    	j--;
    }
    if(foo==1)
    {
    	i=ans.size();
    	ans=s.substr(i,s.size());
    	k--;
    	while(k--)s+=ans;
    	cout<<s;
    	return 0;
    }
    i=0;
    j=s.size()-1;
    while(j>i and s[i]==s[j]){i++;j--;}
    string t=s.substr(i,s.size());
    k--;
    while(k--)s+=t;
    cout<<s;

}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> //for less
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define m_p make_pair
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define double long double
const double pi=3.14159265358979;
const   int  mod=1e9+7;
int takemod(int a){return ((a%mod)+mod)%mod;}
typedef  tree < int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
void ans(int p)
{
	if(p%2==0)cout<<"Ari"<<endl;
	else cout<<"Rich"<<endl;
}
signed main()
{
	ios
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1)
    {
    	k--;
    	while(k--)s+=s[0];
    	cout<<s;
    	return 0;
    }
    int i=0;
    int j=n-1;
    int flag=0;
    int foo=0;
    string h1="",h2="",h4="",h5="";
    while(j>i)
    {
    	h1+=s[i];
    	h2+=s[j];
    	string h3=h2;
    	//cout<<h1<<" "<<h2<<endl;
    	reverse(h3.begin(),h3.end());
    	if(h3==h1)
    		{
    			foo=1;
    			break;

    		}
    	i++;
    	j--;

    }
    i++;
    j--;

    int  k1 = n/(h1.size());
       set<string> st;

    if(foo==1 and n%h1.size()==0)
    {
       int t=k1-2;
       while(t--)
       	{
       		st.insert(s.substr(i,h1.size()));
       		 i+=h1.size();
       	}

    }
    set<string> :: iterator itr;
    itr=st.begin();

    if((st.size()==1 and *itr==h1 and foo==1) or (foo==1 and k1==2 and n==2*h1.size()))flag=1;

    if(flag==1)
    {
    	k--;
    	while(k--)s+=h1;
    	cout<<s;
    	return 0;
    }
    if(foo==1)
    {
    	i=h1.size();
    	h1=s.substr(i,s.size());
    	k--;
    	while(k--)s+=h1;
    	cout<<s;
    	return 0;
    }
    i=0;
    j=s.size()-1;
    while(j>i and s[i]==s[j]){i++;j--;}
    string t=s.substr(i,s.size());

    k--;
    while(k--)s+=t;
    cout<<s;

}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> //for less
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define m_p make_pair
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define double long double
const double pi=3.14159265358979;
const   int  mod=1e9+7;
int takemod(int a){return ((a%mod)+mod)%mod;}
typedef  tree < int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
void ans(int p)
{
	if(p%2==0)cout<<"Ari"<<endl;
	else cout<<"Rich"<<endl;
}
signed main()
{
	ios
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1)
    {
    	k--;
    	while(k--)s+=s[0];
    	cout<<s;
    	return 0;
    }
    int i=0;
    int j=n-1;
    int flag=0;
    int foo=0;
    string h1="",h2="",h4="",h5="";
    while(j>i)
    {
    	h1+=s[i];
    	h2+=s[j];
    	string h3=h2;
    	//cout<<h1<<" "<<h2<<endl;
    	reverse(h3.begin(),h3.end());
    	if(h3==h1)
    		{
    			foo=1;
    			break;

    		}
    	i++;
    	j--;

    }
    i++;
    j--;

    int  k1 = n/(h1.size());
       set<string> st;

    if(foo==1 and n%h1.size()==0)
    {
       int t=k1-2;
       while(t--)
       	{
       		st.insert(s.substr(i,h1.size()));
       		 i+=h1.size();
       	}

    }
    set<string> :: iterator itr;
    itr=st.begin();

    if(st.size()==1 and *itr==h1 or (foo=1 and st.size()==0))flag=1;

    if(flag==1)
    {
    	k--;
    	while(k--)s+=h1;
    	cout<<s;
    	return 0;
    }

    i=0;
    j=s.size()-1;
    while(j>i and s[i]==s[j]){i++;j--;}
    string t=s.substr(i,s.size());

    k--;
    while(k--)s+=t;
    cout<<s;

}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> //for less
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define m_p make_pair
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define double long double
const double pi=3.14159265358979;
const   int  mod=1e9+7;
int takemod(int a){return ((a%mod)+mod)%mod;}
typedef  tree < int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
void ans(int p)
{
	if(p%2==0)cout<<"Ari"<<endl;
	else cout<<"Rich"<<endl;
}
signed main()
{
	ios
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1)
    {
    	k--;
    	while(k--)s+=s[0];
    	cout<<s;
    	return 0;
    }
    int i=0;
    int j=n-1;
    int flag=0;
    int foo=0;
    string h1="",h2="",h4="",h5="";
    while(j>i)
    {
    	h1+=s[i];
    	h2+=s[j];
    	string h3=h2;
    	//cout<<h1<<" "<<h2<<endl;
    	reverse(h3.begin(),h3.end());
    	if(h3==h1)
    		{
    			foo=1;
    			break;

    		}
    	i++;
    	j--;

    }
    i++;
    j--;

    int  k1 = n/(h1.size());
       set<string> st;

    if(foo==1 and n%h1.size()==0)
    {
       int t=k1-2;
       while(t--)
       	{
       		st.insert(s.substr(i,h1.size()));
       		 i+=h1.size();
       	}

    }
    set<string> :: iterator itr;
    itr=st.begin();

    if(st.size()==1 and *itr==h1 or (foo=1 and k1==2))flag=1;

    if(flag==1)
    {
    	k--;
    	while(k--)s+=h1;
    	cout<<s;
    	return 0;
    }

    i=0;
    j=s.size()-1;
    while(j>i and s[i]==s[j]){i++;j--;}
    string t=s.substr(i,s.size());

    k--;
    while(k--)s+=t;
    cout<<s;

}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> //for less
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define m_p make_pair
#define pb push_back
#define f first
#define s second
#define pii pair<int,int>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define double long double
const double pi=3.14159265358979;
const   int  mod=1e9+7;
int takemod(int a){return ((a%mod)+mod)%mod;}
typedef  tree < int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
void ans(int p)
{
	if(p%2==0)cout<<"Ari"<<endl;
	else cout<<"Rich"<<endl;
}
signed main()
{
	ios
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1)
    {
    	k--;
    	while(k--)s+=s[0];
    	cout<<s;
    	return 0;
    }
    int i=0;
    int j=n-1;
    int flag=0;
    int foo=0;
    string h1="",h2="",h4="",h5="";
    string ans="";
    while(j>i)
    {
    	h1+=s[i];
    	h2+=s[j];
    	string h3=h2;
    	reverse(h3.begin(),h3.end());
    	if(h3==h1)
    		{
    			foo=1;
    			ans=h1;
    		}
    	i++;
    	j--;

    }
    if(foo==1)
    {
    	i=ans.size();
    	ans=s.substr(i,s.size());
    	k--;
    	while(k--)s+=ans;
    	cout<<s;
    	return 0;
    }
    i=0;
    j=s.size()-1;
    while(j>i and s[i]==s[j]){i++;j--;}
    string t=s.substr(i,s.size());

    k--;
    while(k--)s+=t;
    cout<<s;

}