QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#364989#8234. Period of a Stringkingsnow_2AC ✓55ms72348kbC++143.6kb2024-03-24 17:46:542024-03-24 17:46:55

Judging History

你现在查看的是最新测评结果

  • [2024-03-24 17:46:55]
  • 评测
  • 测评结果:AC
  • 用时:55ms
  • 内存:72348kb
  • [2024-03-24 17:46:54]
  • 提交

answer

//#pragma GCC optimize(3,"Ofast","inline")
//#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
//#define getchar nc
#define sight(c) ('0'<=c&&c<='9')
#define LL long long
#define debug(a) cout<<#a<<" is "<<a<<"\n"
#define dput(a) puts("a")
#define eho(x) for(int i=head[x];i;i=net[i])
#define fi first
#define se second
inline char nc(){
static char buf[1000000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
template <class T>
inline void read(T &x){// unsigned
    static char c;
    for (c=getchar();!sight(c);c=getchar());
    for (x=0;sight(c);c=getchar())x=x*10+c-48;
}
template <class T> void write(T x){if (x<10) {putchar('0'+x); return;} write(x/10); putchar('0'+x%10);}
template <class T> inline void writeln(T x){ if (x<0) putchar('-'),x*=-1; write(x); putchar('\n'); }
template <class T> inline void writel(T x){ if (x<0) putchar('-'),x*=-1; write(x); putchar(' '); }
using namespace std;
#define N 100007
#define char_len 5000007
int len[N];
char ch[char_len],CH[2][char_len];
void Gen(int id,char *last,char *now){
	for (int i=0;i<len[id+1];i++)
		now[i]=last[i%len[id]];
	now[len[id+1]]=0;
}
int n,p[N][27],lim[char_len],li[char_len][27],la[char_len];
int sta[N],stb[N],tot,tmp[27];
bool cmp(int x,int y){
	return len[x]<len[y];
}
void solve() {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%s",ch);
		len[i]=strlen(ch);
		for (int j=0;j<26;j++) p[i][j]=0;
		for (int j=0;j<len[i];j++) p[i][ch[j]-'a']++; 
	}
	for (int i=0;i<=len[1];i++) lim[i]=0;
	lim[len[1]]=1;
	for (int i=0;i<26;i++) li[len[1]][i]=p[1][i];
	lim[0]=1;
	for (int i=0;i<26;i++) li[0][i]=0;
	tot=0;
	sta[++tot]=1; stb[tot]=len[1];
	for (int i=2;i<=n;i++) {
		int now=len[i];
		for (int j=0;j<26;j++) tmp[j]=p[i][j];
		while (stb[tot]>now) tot--;
		while (1) {
			int x=upper_bound(stb+1,stb+tot+1,now)-stb;
//			cerr<<x<<endl;
			x--;
			if (x==0) break; 
			x=sta[x];
			int newnow=now%len[x],sz=now/len[x];
			for (int j=0;j<26;j++) {
				tmp[j]=tmp[j]-sz*p[x][j];
				if (tmp[j]<0) {
					puts("NO");
					return;
				} 
			}
			now=newnow;
		}
		sta[++tot]=i; stb[tot]=len[i];
		if (lim[now]) {
			for (int j=0;j<26;j++) {
				if (tmp[j]!=li[now][j]) {
					puts("NO");
					return;
				}
			}
		} else {
			lim[now]=1;
			for (int j=0;j<26;j++) li[now][j]=tmp[j];
		}
	}
	int las=0;
	for (int i=1;i<=len[1];i++) {
		la[i]=las;
		if (lim[i]) las=i;	
	}
	for (int i=len[1];i>=1;i--) {
		if (lim[i]==0) continue;
		for (int j=0;j<26;j++) {
			li[i][j]-=li[la[i]][j];
			if (li[i][j]<0) {
				puts("NO");
				return;
			}
		}
	}
	for (int i=len[1];i>=1;--i) {
		if (lim[i]) {
			for (int j=0;j<26;j++) tmp[j]=li[i][j];
		}
		for (int j=0;j<26;j++) {
			if (tmp[j]) {
				CH[0][i]='a'+j;
				tmp[j]--;
				break;
			}
		}
	}
	CH[0][len[1]+1]=0;
	puts("YES");
	int now=1,last=0;
	for (int i=1;i<=n;i++) {
		printf("%s\n",CH[last]+1);
		if (i!=n) {
			Gen(i,CH[last]+1,CH[now]+1);
			last^=1; now^=1;
		}
	}
} 
int T;
signed main() {
	#ifdef LOCAL
	//	freopen("test.in", "r", stdin);
	//	freopen("test.out", "w", stdout);
	#endif
	scanf("%d",&T);
	while (T--) solve();
    return 0;
}
/*
4
2
abc
abcd
4
bbcaa
cabb
acabbbb
a
3
ab
aab
bbaaaaab
3
ab
aab
bbaaaaaa

1
15
baaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbb
ba
bababababababababababababababababababababab
bababababababababababababababab
babababab
bababababbababababb
bababababbabab
baba
bababababababab
b
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
b
bbbbbbbbbbbbbb
bbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbb
*/

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 16140kb

input:

4
2
abc
abcd
4
bbcaa
cabb
acabbbb
a
3
ab
aab
bbaaaaab
3
ab
aab
bbaaaaaa

output:

NO
YES
abbca
abbc
abbcabb
a
YES
ab
aba
abaabaab
NO

result:

ok ok (4 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 18248kb

input:

5
1
ccecddbdbbcbbaded
3
cd
d
d
1
dcedec
2
dcec
cce
8
a
e
a
c
cc
cccccccc
c
b

output:

YES
eedddddccccbbbbba
YES
dc
d
d
YES
eeddcc
YES
eccd
ecc
NO

result:

ok ok (5 test cases)

Test #3:

score: 0
Accepted
time: 34ms
memory: 16144kb

input:

100
147
ababbbaaaaaababbbbbaabaabbbbaaaababbbbababaabbbbaaabbabaaaaaabbbbaabbaaaaaababbbaabbabbaaabbbaabbbabaabbbbaabaabbaa
aaaaabbbbababababbbaaaaaabaaaaabbaabaabaaababbabbabbabbaabbaaabbaabbaabaababaaabbababbbbbaabaaaaabbbbaabbbbbbaaabbbbabaababbbbb
ababbabaababbbbaabbbbaaabbabaabbaaaababbbabbaaab...

output:

NO
YES
babbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaa
ba
bababababababababababababababababababababab
bababababababababababababababab
babababab
bababababbababababb
bababababbabab
baba
bababababababab
b
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
b
bbbbbbbbbbbbbb
bbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbb...

result:

ok ok (100 test cases)

Test #4:

score: 0
Accepted
time: 34ms
memory: 18260kb

input:

100
326
decadadcaaacaaeecaddaeadeadc
aaadedcaaeaaeddddaeaceaddaaaaecccaaeadeaaedaccdddcdddaaaadddacceaaadcadaeeeadeeadccdaacadaaecaedadcaaaecdaddaeaaaeccdedaceaaaacdddcecdcdacddccecaaaeaeedacaeaadaaacdadedae
acaecaaaedcdaceaaddddaaeaddccdaeaadaeedaecdacaadeeaadeceadacdadaccdaaedaddccaceea
ddccacdcea...

output:

NO
YES
edccbebba
edccbe
edccb
edccbedccbedccbedccb
edccbe
e
eeeeeeeeeeeeeeeee
eeeeeeeeeeee
eeeeeee
eeeeeeeeeeeee
eee
eeeeeeeeeeeeeeee
eeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeee
eeeeeeeeeee
eeeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeee
eeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
eeeeeeeeee
eee...

result:

ok ok (100 test cases)

Test #5:

score: 0
Accepted
time: 33ms
memory: 20312kb

input:

100
1114
mmiceajjcjdemdhf
c
ccccccc
cccccc
cccccccccccccccccccccccccccccccccccccccc
ccccccccc
ccccccccc
ccccccccccccccc
ccccccccccccccccccccccccc
cccccccccc
ccc
ccccccccccc
ccccccccccccccccccccccccccccccc
ccccccccc
cccccc
ccccccccccccccccccccccc
ccccccccccccc
ccc
ccccccccccc
ccccccccc
cccccccccccccc...

output:

NO
NO
YES
acgbamcmkifiiheddaabkjfcammmmmlllllllkkkkkkkjjjjjjjjiiiiiiiiihhhhhhggggggggfffffffeeeeeeeeeeeeedddddcccccccccbbbbbbaaaaaa
acgbamcmkifiiheddaabkjfca
acgbamcmkifiiheddaabkjfcaacgbamcmkifiiheddaabkjfcaacgbamcmkifiiheddaabkjfcaacgbamc
acgbamcmkifiiheddaabkjfcaacgbamcmkifiiheddaabkjfcaacgbamcmk...

result:

ok ok (100 test cases)

Test #6:

score: 0
Accepted
time: 36ms
memory: 16156kb

input:

100
512
tecvaycvrbprboqldxlzjmlbfxaseuomtjxenfyoxkmjqkifjpacqytpxmbxleryljfxeoghwfhcnhvimgkvdwjcwatlppmwbbygdbiyzvlrfqjmdnuioulrgmwfkutwgavesanvdzbypveznnvrddujscaekxauxwi
nqmlelkfqrvjbwdlvtbzxkd
kbdqfbqxqqvmkllqltebqmlrnxvxflkzedrmbwknzltfbllqllbwllwqrvkzmrdqlldvnfbkqxbdkewxrzbbndvfqrnfklllxxkvqkjf...

output:

YES
vzxrjblkqemvntfqbkdwlldzzzyyyyyyyxxxxxxxxwwwwwwvvvvvvvuuuuuuttttsssrrrrrqqppppppooooonnnnnmmmmmmmlllllkkkjjjjjjjiiiiihhhgggggffffffeeeeeeedddddccccccbbbbbbaaaaaaaa
vzxrjblkqemvntfqbkdwlld
vzxrjblkqemvntfqbkdwlldvzxrjblkqemvntfqbkdwlldvzxrjblkqemvntfqbkdwlldvzxrjblkqemvntfqbkdwlldvzxrjblkqemvntfq...

result:

ok ok (100 test cases)

Test #7:

score: 0
Accepted
time: 28ms
memory: 22196kb

input:

1000
379
hdiyyp
ihy
hyhyiih
hiyh
iyhhihihhyhy
yhihhyyihhih
h
hhh
h
h
hhhhh
hhhh
hhhhhhhhh
hhhhhhhhhhhhh
hhhhhhhhhhhhhhhhh
hh
hhh
hhhhh
hhhhhhhh
hhhhhhhhhhhhhhhh
hhh
hhhhhhhh
hhhhhhhhh
h
hhh
hhhhhh
hhhh
hh
hhhhhhhhhh
hhhhhhh
hh
hhhhh
hhhhhh
hhhh
h
hh
hh
hh
hh
hhhhhhhhhhhhh
hhhhh
hhhh
hhhhhh
hhhh
h
hh...

output:

YES
hyiypd
hyi
hyihyih
hyih
hyihhyihhyih
hyihhyihhyih
h
hhh
h
h
hhhhh
hhhh
hhhhhhhhh
hhhhhhhhhhhhh
hhhhhhhhhhhhhhhhh
hh
hhh
hhhhh
hhhhhhhh
hhhhhhhhhhhhhhhh
hhh
hhhhhhhh
hhhhhhhhh
h
hhh
hhhhhh
hhhh
hh
hhhhhhhhhh
hhhhhhh
hh
hhhhh
hhhhhh
hhhh
h
hh
hh
hh
hh
hhhhhhhhhhhhh
hhhhh
hhhh
hhhhhh
hhhh
h
hhhhhh
...

result:

ok ok (1000 test cases)

Test #8:

score: 0
Accepted
time: 38ms
memory: 20144kb

input:

10000
21
uiutbnjregblkwbpztgdbmahtlhe
dtulrltbnbtlbggtwmteiwzbejzdlzbtbutiapwhnurumbnutkekbjehanphbhrn
unt
tnnntktntttttnttutnuuuuuunntuuuntununutnntuttunuutttntnuntnuuntuttunnuututuntuttntnunntuntnnuuttutunuunnunuutnuuutnutnutnnntntntunnttntuuttnnuunnnnuuutntn
uttnnnntuuuutututtnttuutuuttnnnnntunnu...

output:

NO
YES
y
y
y
y
y
YES
kzsmmlhbalkgrmaogc
kzsmmlhbalkgrmaogckzsmmlhbalkg
kzsmmlhbalkgrmaogckzsmmlhbalkgkzsmmlhbalkgrmaogckzsmmlhbalkgkzsmmlhba
kzsmmlhbalkgrmaogckzsmmlhbalkgkzsmmlhbalkgrmaogckzsmmlhbalkgkzsmmlhbakzsmmlhbalkgrmaogckzsmmlhbalkgkzsmmlhbalkgrmaogckzsmmlhbalkgkzsmmlhbakzsmmlhbalkgrmaogckzs...

result:

ok ok (10000 test cases)

Test #9:

score: 0
Accepted
time: 41ms
memory: 18300kb

input:

10
16467
aldyra
ylaaaddrraldyaaalaaadrydlyyaryrrl
draya
yaaaadddarayrayraayyyraradddr
yyraayrdardraaadraaydadyya
dray
ay
yaayayaayyayaaaayyyaayayyyayayyayyaaayayya
ayayayyyaayyyyaayayayaa
aaayyaayyaaayyayyyyyyaayayaay
yyyyyayyayyyayyayyaayayayayyayayayaaaaaayayaaaaay
yaayay
ayaayayyyayyyayaayaayyyay...

output:

NO
YES
nbjkmlphywsrqonbwssqqlllljiheddwqooniidcbzxwusrrrqpponigcbaxvusnjicc
nbjkmlphywsrqonbwssqqlllljiheddwqooniidcbzxwusrrrqpponigcba
nbjkmlphywsrqonbwssqqlllljiheddwqooniidcbzxwusrrrqpponigcbanbjkmlphywsrqonbwssqqlllljiheddwqooniidc
nbjkmlphywsrqonbwssqqlllljiheddwqooniidcbzxwusrrrqpponigcbanbjkm...

result:

ok ok (10 test cases)

Test #10:

score: 0
Accepted
time: 35ms
memory: 22604kb

input:

3
32852
zjcsxffjfgqgnvamcemwbswpnxmtxxlecsfpbbaygsvvfhesoexzicbclmctcwhaosjziphqkaechmrguyddlyelzaycvlrffhalklfxlnwkpopijuuusjbwnxqcayjfygjufkpyvnv
zrwxifjqftg
zrgxf
xfggzrfxzr
grffzxxzgffxxzfggfxxfgxfgxzfzzrffxxrrfxxfgrrfzgzzrrgzrfgrzrzfgrrxgrzzgxrgzgx
xrrfrfxzgggxzgfxzrgfrzfzx
grxxfzfgzzgxggzxfzgf...

output:

YES
fzxgrwtqjifzzzyyyyyyyxxxxxxwwwwvvvvvvuuuuutsssssssrqqppppppooonnnnnmmmmmllllllllkkkkjjjjjjiihhhhhggggffffffffeeeeeeddccccccccccbbbbbaaaaaaa
fzxgrwtqjif
fzxgr
fzxgrfzxgr
fzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrfzxgrf
fzxgrfzxgrfzxgrfzxgrfzxgr
fzxgrfzxgrfzxgrfzxgrfzxg...

result:

ok ok (3 test cases)

Test #11:

score: 0
Accepted
time: 40ms
memory: 26788kb

input:

1
100000
mjrbblhjaodzaew
bhdwmabzrloejarj
waaarbwdlobbemzldjrbhjrajejo
mojrjdzwaoearbbdajrjbjleabwhlldr
abjebazdadlobwerbdoablarjjhlrdljrwmjrbje
lohrmrrjrjalaljbzmwobbbdbbdbrarbjejawallraejabddrwajelojlzdjdwlraroejjehdb
edbrlwajjba
bbjaljddbjlbjwderaawljarreb
bjraaewrjbdbdjll
rjdbl
rddjblbdjbrlrjrll...

output:

YES
rljdbebawjaozmh
rljdbebawjaozmhr
rljdbebawjaozmhrrljdbebawjao
rljdbebawjaozmhrrljdbebawjaorljd
rljdbebawjaozmhrrljdbebawjaorljdrljdbeba
rljdbebawjaozmhrrljdbebawjaorljdrljdbebarljdbebawjaozmhrrljdbebawjaorljdrl
rljdbebawja
rljdbebawjarljdbebawjarljdb
rljdbebawjarljdb
rljdb
rljdbrljdbrljdbrlj
rlj...

result:

ok ok (1 test case)

Test #12:

score: 0
Accepted
time: 13ms
memory: 18248kb

input:

10000
2
oodmvpzyxi
vpooodzmmidixopy
25
iosxruvcl
l
lllllllllllllllll
lll
llllllllll
llll
llllllll
llllllllll
l
ll
lllll
llllllllll
l
lllllllll
llllllllll
l
llllllllllllll
l
l
ll
l
ll
l
llll
l
4
plsftdw
tsw
sttttwsswws
x
7
hbopcjceds
scedhbgccdoccechsjbbahpopd
hcq
jcc
klh
hjcjchh
jichchhcjchj
1
i
7
j...

output:

YES
poomidzyxv
poomidzyxvpoomid
YES
lxvusroic
l
lllllllllllllllll
lll
llllllllll
llll
llllllll
llllllllll
l
ll
lllll
llllllllll
l
lllllllll
llllllllll
l
llllllllllllll
l
l
ll
l
ll
l
llll
l
NO
NO
YES
i
NO
YES
yyxwwvuttsrppponnnmlkkjiggfedcccb
NO
YES
zwwvtrqqpnnllkkkjihgc
YES
wvsslledaa
YES
dy
dyd
d
d...

result:

ok ok (10000 test cases)

Test #13:

score: 0
Accepted
time: 8ms
memory: 18188kb

input:

10000
4
a
a
a
a
1
mqoukqzi
5
d
hhhhrdhhhhhhhh
hh
gh
hbhr
4
zcdufv
fdvuzudvcf
f
f
1
s
12
mi
mimimi
m
mmmmmmm
m
m
m
mm
m
mmm
m
mm
20
g
g
s
g
g
g
g
g
g
g
k
g
k
g
g
g
g
u
g
g
11
f
f
f
f
f
f
f
f
f
f
f
9
gv
v
vvvvvvvv
vvvv
vvvvv
v
vvv
vv
vvvvvv
9
ti
t
tttt
t
ttt
tt
tt
t
tt
7
x
k
d
r
r
w
r
6
nc
cf
c
v
hdcc...

output:

YES
a
a
a
a
YES
zuqqomki
NO
YES
fvudzc
fvudzcfvud
f
f
YES
s
YES
mi
mimimi
m
mmmmmmm
m
m
m
mm
m
mmm
m
mm
NO
YES
f
f
f
f
f
f
f
f
f
f
f
YES
vg
v
vvvvvvvv
vvvv
vvvvv
v
vvv
vv
vvvvvv
YES
ti
t
tttt
t
ttt
tt
tt
t
tt
NO
NO
YES
zyyyyyyxxxxxxwwwwvvvuuuuuttttttssrrrrqqpppppoooonnnnmmmmmmlllkkjjjjjiiihhhggfffee...

result:

ok ok (10000 test cases)

Test #14:

score: 0
Accepted
time: 7ms
memory: 16140kb

input:

10000
1
t
8
ecj
ejecjscecjje
cecjejceejc
ecjeceeecjcjcj
cea
oc
ceec
ecbc
34
zevdfbzayddtgja
dea
aaadc
aadaa
daa
a
a
a
x
aa
aaaaaaaa
a
aaa
aa
a
a
ba
aaa
aaaaa
aaaaa
aaa
aaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaa
aaaa
aaa
aa
a
aa
aaa
aaaa
aaaaaaa
aa
aaa
1
xdvwkodeoicwnscdpkhwmxriaudyinlvbniaqhqnldbgtigvra...

output:

YES
t
NO
NO
YES
zyyxxwwwvvvuttssrrqqppooonnnnmllkkjjiiiiiihhhgggfeeddddddccbbaaaa
YES
ezr
ezrezr
e
eee
eee
eeeeeeeeeeeeeeeee
eeeeeeeeeeeeeee
eeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeee
eeeeee
eeeeee
eee
eee
e
NO
NO
YES
u
u
u
u
u
u
u
YES
kimis
kimiskimiskimiskimiskimisk
kimiskimiskimiskimiski
kimiskimi...

result:

ok ok (10000 test cases)

Test #15:

score: 0
Accepted
time: 35ms
memory: 16140kb

input:

10000
3
aabbabbbbabaaaaabbbaaabaaaaaaa
baabababaabaaabaabbaabaababaaaaaaabaaaaaabbaabbbaaabaaaababaaabbaaaaaaaaababbaaabaaaababaaabbbbaababaaaaaaaaabbaaabbbaabbaaabaaaaaabbabbaaaaabaabbaaabaaabaaabaabaaabbabaabaabbaabaaaababababaabbaababbabbaaaabbabababbbbbaaabaaaabaabbbbbaaabaaaaaaaabbaaabaaabaaaba...

output:

YES
bbbbbbaaaaaaaaaaaaabaaaaabbbba
bbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaabbbbabbbbbbaaaaaaaaaaaaabaaaaa...

result:

ok ok (10000 test cases)

Test #16:

score: 0
Accepted
time: 28ms
memory: 16208kb

input:

10000
5
lzmafakuzucfezeldfgsdytjfomzjcfovbdvmagqfuqpwyrxarcgqks
cuszpkqzglakwledzoruucgeqmrfyfoymxvfvfjagazcjdsqfabfmdt
jkeqogazgzuduffffmkefslrfwuz
lkufefzqrzqkafqoffuwzwfrgljsrfuzsdugkfmdoedzzeuegfeufmkjfugffafk
zfzeugdzjaefukgudamlmuufjlufruzjkdojfkgufeuwukzqwlfaqfuogqezzsfrkkukkfadezfgozfffsfoff...

output:

NO
YES
zywwvutttsrrqqqppooommmlllkkkjjiihhgfffeccbbbyyyxxwwwvvrqqpoonmmmkiffeeeddccccaa
zywwvutttsrrqqqppooommmlllkkkjjiihhgfffeccbbb
NO
YES
sexwwvvvsrnkjhhhheecbaabb
sexwwvvvsrnkjhhhheecbaabbsexwwvvvsrnkjhhhheecbaabbsexwwvvvsrnkjhhhheecbaabbse
sexwwvvvsrnkjhhhheecbaabbsexwwvvvsrnkjhhhheecbaabbsexww...

result:

ok ok (10000 test cases)

Test #17:

score: 0
Accepted
time: 35ms
memory: 16092kb

input:

1000
54
aabbbabaabbaaabbababb
abaabbbbbaaabbabbabbbabbaabaa
bbbbbabbbaaaabaabbbbbbbbaabababaaabaaaaabbbbbabbbaaabbaaa
aababbbbabaaabbbbabbbbaabaaa
aaababbbbabaaabababbbbabbaabbbab
aaababbbbbabbababbbabbaaabbaaabbbaabbb
bbaaabaabbabaababbbbbababbaabbbbbabababbaaaababbb
babaaaababaababaaabaaaaaabbbbbb...

output:

YES
babbbaabaababbabbbaaa
babbbaabaababbabbbaaababbbaab
babbbaabaababbabbbaaababbbaabbabbbaabaababbabbbaaababbbaa
babbbaabaababbabbbaaababbbaa
babbbaabaababbabbbaaababbbaababb
babbbaabaababbabbbaaababbbaababbbabbba
babbbaabaababbabbbaaababbbaababbbabbbababbbaabaab
babbbaabaababbabbbaaababbbaababbbab...

result:

ok ok (1000 test cases)

Test #18:

score: 0
Accepted
time: 29ms
memory: 16132kb

input:

1000
26
ayhlojxlxzojvtmgetowruycwvrfjpzjd
yvyoxrurlwdtaegcolmzpvzjtjojfxw
zldlpxyramxfvjjoyzcretvgwjt
lgxpyydjazvvxcojjlzm
xzvyxjladcclxdymvygojpxaljmpgvjzzyzjoj
mjjcxxaxjjjxvjxjadylzzpvdmpvozyzclyyaovgomjlxyplazzxymjyvjlojzydjcycdajlzlxgyzojjzxjvjazjgypxxcglvxmdgcpv
vgcdzoxjaaazvmzygvyjajcxjypjmjyx...

output:

YES
jjxajczyxpzvlymdoglvwttrrfewuoojh
jjxajczyxpzvlymdoglvwttrrfewuoo
jjxajczyxpzvlymdoglvwttrrfe
jjxajczyxpzvlymdoglv
jjxajczyxpzvlymdoglvjjxajczyxpzvlymdog
jjxajczyxpzvlymdoglvjjxajczyxpzvlymdogjjxajczyxpzvlymdoglvjjxajczyxpzvlymdogjjxajczyxpzvlymdoglvjjxajczyx
jjxajczyxpzvlymdoglvjjxajczyxpzvlymd...

result:

ok ok (1000 test cases)

Test #19:

score: 0
Accepted
time: 40ms
memory: 16152kb

input:

100
2237
baabaaabaaaabbbbaabaaaababaaaaba
aaabaaaaabaaabaaababbbababaaaaaaaabbabbaabb
abaaabbaaaaabbaaabbabaaabab
aaaaaaaaaaabaabaaaabaaabbbbbbababaabaabbaaaababaababbaababaabbabbaaabb
abaababbbbaababaababaaababababaaabbaaaaaaaaaaabababaababbaaaaaabb
abbabaaaaaababaaabbaba
abaaaaaabaaababaabbbbbaaaa...

output:

NO
YES
aaaabbaabbbbbabaaaababaaabbbbbbbbbbaaaaaaaaaabbaaaaaa
aaaabbaabbbbbabaaaababaaabbbbbbbbbbaaaaaaaaaa
aaaabbaabbbbbabaaaababaaabbbbbbbbbbaaaaaaaaaaa
aaaabbaabbbbbabaaaababaaa
aaaabbaabbbbbabaaaababaaaaaaabbaabbbbbabaa
aaaabbaabbbbbabaaaababaaaaaaabbaab
aaaabbaabbbbbabaaaababaaaaaaabbaabaaaabbaa...

result:

ok ok (100 test cases)

Test #20:

score: 0
Accepted
time: 25ms
memory: 16152kb

input:

100
2742
cecabdaaaeeeedceceeccceaeabeccdbaabcbdaadddeeaeadaedcedcbcecabadceebeeadec
ceeacdbaecaecaaacacacdebceaedcb
eaacbacccaceeaccceeeeccaeabeeccabdddabcdcbedaaacaecacaaedcaeba
abecadadcebabaeacdacecca
caaaaebeaaccaadaaddacbbbeacecdbeccaadcabecadaccee
cadacbceaabedacacaceba
eabaaecbdccbaacadaaeecc...

output:

YES
aaeecbabccacccaabaaeddedeeecccaeeeeeeeeeeeeeeedddddddddcccccccbbbbbaaaaaaa
aaeecbabccacccaabaaeddedeeeccca
aaeecbabccacccaabaaeddedeeecccaaaeecbabccacccaabaaeddedeeeccca
aaeecbabccacccaabaaedded
aaeecbabccacccaabaaeddedaaeecbabccacccaabaaeddeda
aaeecbabccacccaabaaedd
aaeecbabccacccaabaaeddaaeecb...

result:

ok ok (100 test cases)

Test #21:

score: 0
Accepted
time: 16ms
memory: 20244kb

input:

100
463
oygvfytmfirgjwwqspymwkpky
ywjskfvwgtwyqmykopgympf
svytqkpfgpmjfomykwyykwftymwpomwqywg
vqgyytmykywjpwmjmfwtwwwptyfmksykommygywfyofoqggwkympksypfvtoykpq
kkfpmqwfotgywwfmkspymwkqjpmpvfqytyomytgwomwwyyy
fpgymswyqjowmyqomyfvwgwkwpyfyktkftymtpqmykwo
ystpkmygoymwkwgotfyvjkywfmpqy
ktfwqpykjgmvpmgwyy...

output:

NO
YES
tpqvnumazibxxszfonpkdkicpazzzyyyxxwvsrrrqqoonnnmmmlljjihgggfffedddccccbarronmjzzzzzzzzyyyyyyyxxwwwwvvvvvvvvvuuuuuuuutttttsssssssssssrrrrqqqqqppppppoooonnnnmmmmmlllllllllkkkkkjjiiiiiiiiiiiiihhhhhhhgggggggggffffffffeeeeeeeddddddcccbbbbbbbbaaaaaaaa
tpqvnumazibxxszfonpkdkicpazzzyyyxxwvsrrrqqoonnn...

result:

ok ok (100 test cases)

Test #22:

score: 0
Accepted
time: 34ms
memory: 24476kb

input:

10
1037
babbabbbabbababbaaaabaaabaabbaabaaabbaabbbaaaab
abbaabaabaaaaabababaaaabbaabbbbbbbbababababbaa
aaaabaaaabbbbbbbbababababbaababaabbbaaabababbaaabaaaaaabbabaabababaabbabab
aaaaabaaaabbabbbabbbbaabbbabbbabbaaababaaababaaba
aaabbaabbbabaaabbaaaaaababababbbbab
baabaabbaabaaaabbabbababbabaabbaab
b...

output:

YES
aabaabbabbbbaabbaabaabbaaaaabbbbaaabbbbbbaaaaaa
aabaabbabbbbaabbaabaabbaaaaabbbbaaabbbbbbaaaaa
aabaabbabbbbaabbaabaabbaaaaabbbbaaabbbbbbaaaaaaabaabbabbbbaabbaabaabbaaaaa
aabaabbabbbbaabbaabaabbaaaaabbbbaaabbbbbbaaaaaaab
aabaabbabbbbaabbaabaabbaaaaabbbbaaa
aabaabbabbbbaabbaabaabbaaaaabbbbaa
aabaa...

result:

ok ok (10 test cases)

Test #23:

score: 0
Accepted
time: 30ms
memory: 18268kb

input:

10
3928
ryebddpjljiukrikjtylkpbwsyicayhhc
yrtckcaijkhutpjrlpiyyppkbwicdklyiydrdbiihlyybkcesjb
tkkdahhldwkpisyypjbyiicerccbjuljpyrkdil
ilypujtjbckirykdhlcybkpi
yjtphkbpkriiykkbjiccucdyll
tybkjirukdiipbjiulciryyyupjklkrypcddkylkckcirhlkibyyjpkdjilkkjkcpkcpyyyjcpklpbiucihtyitiulckbbcjkycpjybklicbplykcb...

output:

YES
ckdilpcyykbyibitrphlkujjywsrjheda
ckdilpcyykbyibitrphlkujjywsrjhedackdilpcyykbyibitrp
ckdilpcyykbyibitrphlkujjywsrjhedackdilp
ckdilpcyykbyibitrphlkujj
ckdilpcyykbyibitrphlkujjck
ckdilpcyykbyibitrphlkujjckckdilpcyykbyibitrphlkujjckckdilpcyykbyibitrphlkujjckckdilpcyykbyibitrphlkujjckckdilpcyykbyib...

result:

ok ok (10 test cases)

Test #24:

score: 0
Accepted
time: 38ms
memory: 24688kb

input:

1
100000
abbaabbaaabbbbbbbbbbbabbabbbbbbaabb
bbabaabbbabbbbabbbbbabbbbbbbabbabababbaabb
ababbababbbaaabbaabbbbaabbbbabbbbbbbbbbbbbbbbbabababaabbabbbbbaaaababbbbabbbbbbbbbabbbbbbbbabbbbbbbbbaabbbbbbbabbababbaabbabbbabbbbabbbabbbaabababbabbbbbababbbabbabbbababbabaaabbbbbbbbbb
babbabaaabbbbbbaabbbbbabb...

output:

YES
abbbbababbbbabbbbbabbbbbbbbbaaaabba
abbbbababbbbabbbbbabbbbbbbbbaaaabbaabbbbab
abbbbababbbbabbbbbabbbbbbbbbaaaabbaabbbbababbbbababbbbabbbbbabbbbbbbbbaaaabbaabbbbababbbbababbbbabbbbbabbbbbbbbbaaaabbaabbbbababbbbababbbbabbbbbabbbbbbbbbaaaabbaabbbbababbbbababbbbabbbbb
abbbbababbbbabbbbbabbbbbbbbbaa...

result:

ok ok (1 test case)

Test #25:

score: 0
Accepted
time: 46ms
memory: 24740kb

input:

1
100000
baababbaababbaaabaabaabbaabbbabbbababaabbaabbbabbaaabbbbbaabaa
bbbaaaababaaaaa
bbaabaaaabbababaabaabababaaaabaaabaaaaaaababa
abaabbaaaababaaba
abbaababbaaabbaaaa
bbbaaaaaaabbabababaaaabaaaa
aabbaaababaaaabaabaaaababbbabaaa
baaaaaaaabbaaaaabaababbbbaabaaabaaaaababa
aaabaaabbbababbbaaaa
babab...

output:

YES
babaaaaaabaabbabbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaa
babaaaaaabaabba
babaaaaaabaabbababaaaaaabaabbababaaaaaabaabba
babaaaaaabaabbaba
babaaaaaabaabbabab
babaaaaaabaabbababbabaaaaaa
babaaaaaabaabbababbabaaaaaababaa
babaaaaaabaabbababbabaaaaaababaababaaaaaa
babaaaaaabaabbababba
babaaaaaab...

result:

ok ok (1 test case)

Test #26:

score: 0
Accepted
time: 19ms
memory: 22668kb

input:

1
100000
ogecmjpwerfmfmapxnrtjzgymywjxizyfrnomwxhqdeconkmkyw
rojkqgyjnzpxyknaxdpgwzwf
poazxkfkowqrypjkkzxzjqpqngyqwyzfrnjkypgfpjxkowjyzgdwxwnxwzdnpaoynkrggjzngjxawdp
zynynygpqpzdqonwxgfjzprxgpafwqjnraxzkodwjowkykgkjx
rodznjznjqdaxjfwnoqgxyyopxgkkkwgppwkxzyfnzrjwygqap
pakjzpnwgjxrgwzfzokqqkyoydwxn
xk...

output:

NO

result:

ok ok (1 test case)

Test #27:

score: 0
Accepted
time: 39ms
memory: 28620kb

input:

1
100000
ihuppckdjjsbspctuttc
dbpsibscpcjpsjktcpbscpubjstupjcuutkpchsitjpsbbhtdktcccdhkjhcpcutskujpcsptjptssiupjpuuhtipttuicipdhsdjctpdbtjutptppupjtcctthtupcjskpcbcsdsjjputckujcicschhtttkducpcji
hpjiktthjjssbkcdbuucttppscupkjtptcuscppbddicjpcuths
cjbkpuphsctpjuscthbhditipcpdputtcuspsjbtjpthckkcjdttp...

output:

YES
jchpkpbdstucpicsjutt
jchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchp
jchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstu
jchpkpbdstucpicsjuttjchpkpbdstucpicsjuttjchpkpbdstujchpkpb...

result:

ok ok (1 test case)

Test #28:

score: 0
Accepted
time: 11ms
memory: 22416kb

input:

1
50000
wpmbctmpdufpqucxpynbxleqtnvnmahajofjenodxqdmtvhjgxkaalzqgvamarwjbjytsgehjgrbqawyhoujwlobjlpyqwl
ojapjpjpcqwxhghmvnenmugwwxtjoeanuleahdbnhotmkalrqmcojwwtljbonuyaxbyqfwgpgqcjnlrqmpaquxlyldatvyspqpjqybdhxvadqjobzfbwuqxahru
xhanwqbwppqryeoahgoxlqmuhmxpwmquyjxwuhcadnjl
uywucuoahwwqxaneyywaxonenml...

output:

NO

result:

ok ok (1 test case)

Test #29:

score: 0
Accepted
time: 28ms
memory: 24520kb

input:

1
50000
muzrveujbtkgwktuzfsuuclmecucfpmkhmlqzbydnagqedywghjhzhtxaow
tbhgfwqluyzzwkbmasuwqphjoalumuwfunuaezbhcuwkkceduufmdztgtbvmzgtjcuqpcrulrzzwtecxhkugzemxmgyyhdmjmyh
bmerqmqhzuftbcajtfxrtymwyzhuuulkdwnqmwywhzevgauhgaxmczwzmulcgybgzudzodusphblekmjkcpuktfw
jfdwbfzawqqrmlckwlmmkcjzudwbhpmggdkuwwtrfpx...

output:

YES
cyumwukymlzxmrabpqdhwgzzbwuftcjmtehuzuugvtsqonlkkjhhgfeedca
cyumwukymlzxmrabpqdhwgzzbwuftcjmtehuzuugvtsqonlkkjhhgfeedcacyumwukymlzxmrabpqdhwgzzbwuftcjmtehuzuug
cyumwukymlzxmrabpqdhwgzzbwuftcjmtehuzuugvtsqonlkkjhhgfeedcacyumwukymlzxmrabpqdhwgzzbwuft
cyumwukymlzxmrabpqdhwgzzbwuftcjmtehuzuugvtsqonl...

result:

ok ok (1 test case)

Test #30:

score: 0
Accepted
time: 46ms
memory: 72348kb

input:

1
100000
tfachkqbvxppacinlodgymgniazuyyozoreheehctbqzrezzvclzzetgtyxdcbqfvegqkqrzwwajisqixlzccdgxqeqcfsqvinarlgefiyxgscymzuyqaknbhotzatiqrcmpwxetjypqbrqovslhnnnifpacwcufuztsbvrfxcvmopnccqlpskhkaqxmrutqnlcvdwrmtfyvtqokwzhwzsajzkviwqdyocyejcuggusnlqgbjeyiofhzgkxsushlnlnwafrkdhdbghipwehuzzgvhkftklqslwj...

output:

YES
mzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

result:

ok ok (1 test case)

Test #31:

score: 0
Accepted
time: 40ms
memory: 72124kb

input:

1
100000
bysvohgnpqvgsdmjhujfbckrqoedifrmfcfafxmvnmcnghjxlejplurbbpmuqjzciezjzjzkkpyfaoxpnaymxoktxcndgqjumjerxlkbsrzviiiawaufrjtunrkfbrjjkeuibhfgpxtwoxowlznpiaypuyucfhakanfhhkxfqhldgphxkmzgcqdbabbiexarsmegtqllxeerrnwzegiqzcbhnuldiigxjttvukbsfyxqytebpylyfpmdusyiohfugynrgvvnnymwrtekniykkebojcnmljsbwmy...

output:

YES
juzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

result:

ok ok (1 test case)

Test #32:

score: 0
Accepted
time: 52ms
memory: 70272kb

input:

1
100000
rrkuldhnwpyskfchbilaycnjdlqtucuxuawqgqrsgygdoqfwuwuyqwfrwumczjzrbceapbumhyyivsmyriojbhigmbwmcpcebixforynxzuajlqkyzhvbxgsfztsdexrhlqelgbajszxbltofwgsxylxzgdsyhclwvmhpritxffbevbidtietbqosejqydkvyungntfuynbflfukzenfgvdfddftwnuyifpahxrkwkpmszbqnmvpehycwnexkteswavtxszupxfzsmnplbylmnomkeryrjrzqlp...

output:

YES
cfdzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

result:

ok ok (1 test case)

Test #33:

score: 0
Accepted
time: 19ms
memory: 47020kb

input:

1
100000
dkupibsvytfhbpiopkcbqhttgqbvwhcxhpsslrjdbpziobtjlnaapmgucenyjqvrnknlnonmprpbjvqucnvglogqphcirlsjwgrbcxxceherupuexdgmzuhltrrekigaaaoizaehsifuvzioukwrjqblkdhlwasslcylzjlodbnaanuchomlmeawyytiqclnmbmdfmqukgegffoliexckahthrpyjdooxhdfobnrrnalquibgamqquvciyuxrvtjlncciowaddxnzmdcpjlhrnizhoyctigzyfp...

output:

NO

result:

ok ok (1 test case)

Test #34:

score: 0
Accepted
time: 16ms
memory: 42992kb

input:

1
100000
tkdjkxwxkjhggjxsnyztngomawuxbhglrpqfrupopxvhgfwwbcvchsoibhdunnhrujjlerjpakfdsovngtknepnvbgktfldzxvujutjykuhrnrvmtgvoznkzoyveqrtenqnevomphdjhoewfctsecybjixonmdrxmdlpxlyroxezbzinrluniaykkbcyhubdyrvewcoijesqohhqsjkccepvjvcapjbrtckeuoysbezinafwndwqcmprdoufoxntcfbjabwwtlfncauyzrmwxdkyrepeujbeucz...

output:

NO

result:

ok ok (1 test case)

Test #35:

score: 0
Accepted
time: 24ms
memory: 33016kb

input:

1
100000
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m...

output:

YES
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
...

result:

ok ok (1 test case)

Test #36:

score: 0
Accepted
time: 42ms
memory: 33400kb

input:

1
100000
uj
ju
uj
ju
ju
uj
uj
uj
uj
uj
uj
uj
uj
uj
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
uj
uj
ju
uj
ju
ju
ju
uj
ju
uj
uj
uj
uj
ju
ju
uj
ju
ju
uj
uj
ju
uj
ju
ju
ju
ju
ju
uj
uj
uj
uj
ju
uj
ju
uj
uj
uj
uj
ju
ju
ju
uj
ju
uj
ju
ju
ju
ju
uj
uj
uj
ju
ju
ju
ju
ju
uj
ju
uj
ju
ju
uj
ju
uj
uj
uj
ju
ju
ju
uj
ju
uj
...

output:

YES
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju
ju...

result:

ok ok (1 test case)

Test #37:

score: 0
Accepted
time: 30ms
memory: 33480kb

input:

1
100000
cfd
fcd
dfc
fcd
dfc
dfc
fdc
fcd
dcf
cdf
cdf
cdf
dcf
dfc
dfc
cdf
dcf
dfc
dfc
cfd
dfc
fdc
cdf
cfd
cfd
fdc
dcf
dfc
fdc
cfd
cfd
cfd
fdc
fcd
dfc
cdf
fdc
dfc
cdf
dcf
cfd
dcf
cdf
fcd
dcf
fcd
cdf
cdf
fcd
dfc
dcf
fdc
fcd
fcd
fdc
fcd
fcd
cdf
dcf
fdc
cdf
fcd
cdf
dfc
dfc
dfc
cfd
cfd
dcf
fcd
fdc
dcf
cfd...

output:

YES
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
cdf
...

result:

ok ok (1 test case)

Test #38:

score: 0
Accepted
time: 36ms
memory: 33212kb

input:

1
100000
sgwqbkkgr
wrksgq
swrg
gwsr
rgwrs
wrsgr
wgrs
swrg
srgwr
swrrrsg
sgwr
grws
rgsw
rwsg
wgsr
gswrr
srgwrrs
sgrw
wrgs
gswr
sgrw
rwrgs
wsgr
rwgrwgrss
sgrwsr
wrrsrgs
gswrrs
rswg
rgsrw
ggrwrwrss
wsgrrsr
gswr
gwrsrsg
ssrggrswrg
srwrg
gwrsr
rrswgr
rwgs
gsrwrs
sgrsrwr
wsgr
swrgsr
rgrws
rgrswr
grswrr
sr...

output:

YES
rsgwqkkgb
rsgwqk
rsgw
rsgw
rsgwr
rsgwr
rsgw
rsgw
rsgwr
rsgwrrs
rsgw
rsgw
rsgw
rsgw
rsgw
rsgwr
rsgwrrs
rsgw
rsgw
rsgw
rsgw
rsgwr
rsgw
rsgwrsgwr
rsgwrs
rsgwrsr
rsgwrs
rsgw
rsgwr
rsgwrrsgw
rsgwrrs
rsgw
rsgwrsg
rsgwrsgrsg
rsgwr
rsgwr
rsgwrr
rsgw
rsgwrs
rsgwrsr
rsgw
rsgwrs
rsgwr
rsgwrr
rsgwrr
rsgwrr
...

result:

ok ok (1 test case)

Test #39:

score: 0
Accepted
time: 40ms
memory: 32968kb

input:

1
100000
zjtjcbrklxtk
jjzcttbl
cjlttzjtjjb
tzbjjt
tbjjt
tjbjtjjt
bjtttj
ttttjbtjbjjt
btjtjt
ttjjtjbjt
jbjttt
jjbtttjtj
jttjtbtj
ttjttjb
tjjttbtjjtjttttttbtbj
tbjjtt
jttbjtt
tjbtttjtj
ttttjtbjjtjtjjtttjttjtbttjtbj
tjttbj
tbtjtj
ttjtjjbt
btjjttjt
btttjj
ttjbbtjjtj
jjbtttjt
tjttjtbtjj
jjbtttt
tjjttbt
t...

output:

YES
tjjbtzlcxrkk
tjjbtzlc
tjjbtzlctjj
tjjbtz
tjjbt
tjjbttjj
tjjbtt
tjjbtttjjbtt
tjjbtt
tjjbtttjj
tjjbtt
tjjbtttjj
tjjbtttj
tjjbttt
tjjbttttjjbttttjjbttt
tjjbtt
tjjbttt
tjjbttttj
tjjbttttjtjjbttttjtjjbttttjtj
tjjbtt
tjjbtt
tjjbtttj
tjjbtttj
tjjbtt
tjjbtttjjb
tjjbtttj
tjjbtttjtj
tjjbttt
tjjbttt
tjjbtt...

result:

ok ok (1 test case)

Test #40:

score: 0
Accepted
time: 37ms
memory: 25560kb

input:

1
100000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #41:

score: 0
Accepted
time: 55ms
memory: 69980kb

input:

1
100000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #42:

score: 0
Accepted
time: 46ms
memory: 69364kb

input:

1
100000
aabbaaaabaabaabbabbababaabaaabbaabbabbaabbbaababababbbaaabbabaaaabbbaabbbababbaaabbaaaabaabbbabbabbabaaabbbbaabababbbaaababbbbbbbabbbbbaabbabbaabaabaababaabababbabbbabbaabbbbaabaababbbabbaaaabaabaaaababbaaababaabbbaaaabaabbaabbaaababaabababaaaaaabaabaabababaaabaaabbbaaaabaabaabaaaabbbbbabaa...

output:

YES
baabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

result:

ok ok (1 test case)

Test #43:

score: 0
Accepted
time: 22ms
memory: 16164kb

input:

1
3162
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #44:

score: 0
Accepted
time: 29ms
memory: 20232kb

input:

1
3162
bbbbabbababaabaabaaabaabaabbbaaaabbbabbabbbaaaaababbbbbbaaaaaabbaaaabaaabaabbbababbbabbaabaababaabbbbbbbbaabbababbaaabbaababbbaaaabbbbbbbbabaaaabaaaababaaababbbbabbbbbbbbbbabbbabbabbbbbabbabababaabbaabaabaaaabbabbbbaabbbabaaabaabbaaaaababbabbbbbbaabbbbbaabbbbabaaaaaaaaabaabbabbbaabaabaaabaaba...

output:

YES
abababaaaaabaabbabbbaaaabbbabbabbbaaabaaaabbbbaabbaaaabaabbaaaaaababbbaaaaabbbbbbbabbbaaabbabbaabbbbbabbbabbbaabaabbbaababbbaaabaaaaababaabaabbaaaabbbabaaaabbbbabbababaababaababbabbaaabbbbbabbabbaaaabbaaababbaabbbaaabaaabaababbbaabbbabbaabbabbbaabbabaabaaababbbababbbbaababbbabaabbbbbaabbaabababa...

result:

ok ok (1 test case)

Test #45:

score: 0
Accepted
time: 15ms
memory: 20208kb

input:

1
3162
nuxkmfvlestahpxpfaprpidolroqeztqakhbkgsaspmfgntzwevlgpwgrjhfdqqqdudhqnjheltstzosigqrvbpxuwmbgmdieihfxcdfooleleoxnmsefqiqtnzqjvovdfdrwijcxkuogocffxlfuejjjdbtwhcnennlytynndnvcbroijlbpbksgpuqvoyiqptuueuuxkmdmfmjdmlkulppcwzbmdauukvpgsptqcunkfhftczygkxhjinaurnilylzvfssitnjntnweqrczhvkmzpqzkyvzxbul...

output:

YES
fznlnvkbxozdqwexgirpqpiiluzqfmsrrxjdjibhuaypszukfjrxpjplcheozuebhgohmglanruldhvegralifrpmpdqalrckzbksbvevcmlivzarcyjifeocmrjalrubdxlkzswmsebrvzpmkwgymreixtavscbaygfdhgzbsgmohavzcpiegovepjvvlqcfoyesarlcegiizqtidraooxieofclpacojcsngwchmemeplfplifofxkueqswsfclitdchqpbdymcxwpbahbilfhkydcougieqhwegdd...

result:

ok ok (1 test case)

Test #46:

score: 0
Accepted
time: 25ms
memory: 16180kb

input:

1
4472
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #47:

score: 0
Accepted
time: 31ms
memory: 18220kb

input:

1
4472
ababaababbaabaabaababbabaaabbaaaabbaaabbabbabaabbbbbbabbaabbbabaabaabbaaabaaaabbaabababbaabbbbbbaaabbababaabaabaabbaabbabbaabbabaaabbbbbbbaabbaabbabaabbbaaaabbabbaaabaaabbbbbbbbaaaaaababababaaabaaabbaaaaaaaaabbaaabbabbaabbbbabbbababbbbabaababbbbaaaabaabbbbbabaaabbbabbbbaaabbaaaababaaaabbabaab...

output:

YES
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

result:

ok ok (1 test case)

Test #48:

score: 0
Accepted
time: 27ms
memory: 20308kb

input:

1
4472
ebjvyazjaqkhfirvcnnbupxkcjfsoooulwvdvjfxnyelfcvhmgjmgxvpozhnwwhajfusradoixqfdizjyydatecqxnqzpbaoeboucsjpxwdwtsqhklpecwharpqrwkkvjbmzhnrahxnbykhhrmacremhjcdytpbempsdhvxashnqrnetspfkubirisesvcodkmacihtwutqlfijcvaphjvffmwlgtmdlhiytiusedkltxkvahrfddhjgncgxjmkmwvkysqfjxkomxzxmizvhuxmcpcaxqeomwbkdi...

output:

YES
fzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuutttttttttttt...

result:

ok ok (1 test case)

Test #49:

score: 0
Accepted
time: 25ms
memory: 18208kb

input:

1
4245
baabbabaaaaaaaabaabbababbbbaaababababbbbbaabbaababbbbaabaaaaabaaabaabaaabbbbabbaabbabbababbbabbabbbbbbabababbbbbbaaaababbaabbaaaababbabbabbbbabaababbaaaaaabbbaababaabaaabbabaaabaaabaabbbabbaaaaaabaabbbabbbaaabababaabbabababaabaaabaabaabaaaaaaabaabaabbaaaabaaabaabaabaaaaabbabaaaaabaabbaaababbb...

output:

YES
bbaababaaabababbbabbbbbabaaaababababbaababbaaabbabbbababaaaababbbbabbbababbaaaababbbaabaababbabbbaaaabbabbbabbaaaababababaabbbbbbaaababaabaaababaabababbbababbbbabbabaabaaabaaabaaababababaaabbbaaaaabaabbbbbbbababbabababbaabaababaabbbbaaababaabbaaabaabaabbbbaaabababbbaabaaabaaaabaaaaaabaaabaaaabba...

result:

ok ok (1 test case)

Test #50:

score: 0
Accepted
time: 23ms
memory: 16164kb

input:

1
3501
abbbabababaaabbbbbbbaaababaabbbaaaaabaabbababbabaabaaaaaababbbbbbaaaaaaabbabababaabaaabbabbbbbbaabababaabbbaaaaaabaaabbaaaabbbabaabbababbbaaaaaabbabaababbbabababbabaabbbaabababaaaaaaaaaaaabbbbbbabbabbabbbbaaaaaabababbabbbbaaababaabaaaaabbaabaabbbabaaabbbbaaaaaaabbbabaaaaabaabbaaababbbbabbabaa...

output:

YES
babbabbbabaaabbabababbabbaabbabbbbbaabbbaaaabbaabaabaaaabbbbbbaabbaaaababbbabbabaaaaababbaabbabbaabbbabbbbbbaabbbbabbbaaaabbbbbbbbbbbababbabaaabbbabaaababbbabaaaabbaabbabbbaabaaaaaaabaabaaaaabbbbaaabaabbaabaabbabbaaababbbaaababaaaabaaabbbbbbbabaabbbbaaaabbbbabbaaaababaaaaaaaabbababbbabbabaaabaaa...

result:

ok ok (1 test case)

Test #51:

score: 0
Accepted
time: 26ms
memory: 22348kb

input:

1
3266
aaabbaabbabbabaababbbabbbbbbabbbbbbbbbbbbabbbaaaabababbaaabbababbaaababbbbbbaaabbaabbaaaaaaaaababbbbaaabbbbaaabbabbbbbabaaabbabbbbbbaababbbababbababbbbbabbabbbbabbabbaaabaaabbbaabbbbaaabbbbaabbbbabababababbabbbaabbbbaababbaaababbbbaaaabaaaabaaaaaaabbaaabaaaabbaababbbaaaabbabbaaaabababaabababa...

output:

YES
bbbabbaaaabaabbbbbbabaababbbbababaaaaabaabbbaabaababaabababaabbaaabbabbbbbbbaababbaaabababaabbbbaabbbbabbabbabaabaaabbaabbbaaaabbbbbababaabbabbaaabaabbbaabaabbaabbabbbaabbbbabaabababbaaabbabbababbaaaabaaaaaabbaabbabaabaaaaabaabbaabbabbbabaabbbbbbaaabbbbbbaabababbabbbabaababbbbaaaaababaababbaabaa...

result:

ok ok (1 test case)

Test #52:

score: 0
Accepted
time: 25ms
memory: 16228kb

input:

1
3182
bbaabbabbbaabbbabbabaabbaabaababbabbbabaabababbbbbbaaaabaabababbabbbaabbbbabbaabababaaabaaaaaabbbaaaaabababaaaabaaabbbaabaabaaaaabaaababbbbabaaaabbbbaaabbbbaaabaabbababbbaababaaaaabbabababbabaabaaaababbabaaaabbabababaaabbbbbbbababbbaaaabbbabaabbbbbaaababbabbbbbbbbbaabbaabbabbbbbaaaabbaaabbbaa...

output:

YES
abaabaabababbbaabbaaaaaabbbabbabaaaabbabbbaaababaabbababababbbabaaaaabbbaaabbabbababbaaaabbbbbaaabaabaaabaaaabbbaabaabbbbaabaaaaabaababbaaaabbbbabaabaaaaababbbbababaaaaaaabbaabbbaaabbbaabaaaaaababbbbbabaaaaabbbabaababbabbbaaabbbabaaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbba...

result:

ok ok (1 test case)

Test #53:

score: 0
Accepted
time: 26ms
memory: 16148kb

input:

1
3114
dqtpwgqrbmryzxhxhhvkgfxkahfoklpjybeyargraoznegtxjf
towkjgqkhtrkfyxqxygafjhpprorbvadzymebjhhfeglxgznxra
knexjjrzkayothdbfawovlhytzgegjphghxfrayrbxfqqkrpjgmx
jxaggxxaqejhnrrdvtmrlhhzozbkyjegryqabtwfpohjypxjfkgkf
ktyqxpylexbkrerhxjongywdzrxhrfzjvojjaabpjghhmfgtqkfagj
bzrgrqwfnkkpggxjxyjajlkbypve...

output:

YES
jzzyyyxxxxwvttrrrrqqppoonmlkkkjhhhhggggfffeedbbaaa
jzzyyyxxxxwvttrrrrqqppoonmlkkkjhhhhggggfffeedbbaaaj
jzzyyyxxxxwvttrrrrqqppoonmlkkkjhhhhggggfffeedbbaaajj
jzzyyyxxxxwvttrrrrqqppoonmlkkkjhhhhggggfffeedbbaaajjj
jzzyyyxxxxwvttrrrrqqppoonmlkkkjhhhhggggfffeedbbaaajjjj
jzzyyyxxxxwvttrrrrqqppoonmlkkkj...

result:

ok ok (1 test case)

Test #54:

score: 0
Accepted
time: 27ms
memory: 20276kb

input:

1
3162
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaaa
aaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa...

output:

YES
a
aa
aaa
aaaa
aaaaa
aaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaaa
aaaaaaaaaaaaaa
aaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #55:

score: 0
Accepted
time: 30ms
memory: 16204kb

input:

1
3161
sl
lsl
slll
llsll
lsllll
lllslll
llllllsl
llsllllll
lsllllllll
lllllslllll
lllsllllllll
lllllslllllll
llllllllllllls
llllllllsllllll
lllllllllllsllll
lllllllllllllllls
lllllllsllllllllll
lllllslllllllllllll
slllllllllllllllllll
lllllllslllllllllllll
slllllllllllllllllllll
slllllllllllllllllll...

output:

YES
ls
lsl
lsll
lslll
lsllll
lslllll
lsllllll
lslllllll
lsllllllll
lslllllllll
lsllllllllll
lslllllllllll
lsllllllllllll
lslllllllllllll
lsllllllllllllll
lslllllllllllllll
lsllllllllllllllll
lslllllllllllllllll
lsllllllllllllllllll
lslllllllllllllllllll
lsllllllllllllllllllll
lslllllllllllllllllllll...

result:

ok ok (1 test case)

Test #56:

score: 0
Accepted
time: 25ms
memory: 18208kb

input:

1
3160
tmh
mhth
hthhm
hhhhmt
hhthhhm
mhhthhhh
hhhmhhhth
hhhthhhhmh
hhhhhthhhmh
hhhhhhmhhhht
thhhhmhhhhhhh
hhhhmhthhhhhhh
hhthhhhhhhhmhhh
hhhhhhhhhhhhmhht
hmhhhhhhthhhhhhhh
hhhmhhhhhhhhhhhthh
hhmhhhhhthhhhhhhhhh
hhhhhhhmhhhhhhthhhhh
hhhhhhhhhhmhhthhhhhhh
hhhhtmhhhhhhhhhhhhhhhh
hhhhmhhhhhhhhhhhhhhhthh...

output:

YES
htm
htmh
htmhh
htmhhh
htmhhhh
htmhhhhh
htmhhhhhh
htmhhhhhhh
htmhhhhhhhh
htmhhhhhhhhh
htmhhhhhhhhhh
htmhhhhhhhhhhh
htmhhhhhhhhhhhh
htmhhhhhhhhhhhhh
htmhhhhhhhhhhhhhh
htmhhhhhhhhhhhhhhh
htmhhhhhhhhhhhhhhhh
htmhhhhhhhhhhhhhhhhh
htmhhhhhhhhhhhhhhhhhh
htmhhhhhhhhhhhhhhhhhhh
htmhhhhhhhhhhhhhhhhhhhh
ht...

result:

ok ok (1 test case)

Test #57:

score: 0
Accepted
time: 22ms
memory: 16240kb

input:

1
3114
qzvpdpadbydbwtinrhdpqzirdcvyeryggcgvxdxwsekdtiquzm
kqtvmzgcrxsdvpbvgrgeypzicedhydbiwazxpyirzndwdddutqq
zzxrihucybvtgvptdixgdgvzecrdpdddynzsdrmqqykbawqpzewi
tdptvwzeschyzcrziypizrgvreqqkzxddwbpmngddqvbadyzxiudg
iqgcqidmbrepqizdytdugvzbyatzdpgevdcdxrvxkdwnpzzswhzyrz
gddirbwuiydzernqamqdpycgqxtd...

output:

YES
zzzyyyxxwwvvvuttsrrrqqqpppnmkiiihgggeedddddddccbba
zzzyyyxxwwvvvuttsrrrqqqpppnmkiiihgggeedddddddccbbaz
zzzyyyxxwwvvvuttsrrrqqqpppnmkiiihgggeedddddddccbbazz
zzzyyyxxwwvvvuttsrrrqqqpppnmkiiihgggeedddddddccbbazzz
zzzyyyxxwwvvvuttsrrrqqqpppnmkiiihgggeedddddddccbbazzzz
zzzyyyxxwwvvvuttsrrrqqqpppnmkii...

result:

ok ok (1 test case)

Test #58:

score: 0
Accepted
time: 27ms
memory: 20196kb

input:

1
2702
mxzrvoigikocbftgdijbvzqbkzhyydmqkyybrveuhbujiyjotmsekzxhwximyxunmkeinompecldkudepqcobaahquotkxbhwuonaisauzhrujslcssvuilfxbdgdqxrbammvklwinzzixqztrifpszorvvihcxthcmshpuqjvexrngdgeouhxfikjfonytbxmnqflqmmaqirjmnkvvsxcpiejebtjhrkvkoofslqtgwrcszrchcspigupkchuanrjjlnqkjvhlgijszghegqnteifsesypeyrctt...

output:

YES
pzzzzzzzzzzzzzzzyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxwwwwwwwwwwwwwvvvvvvvvvvvvvvvvvvvvvvvvvvuuuuuuuuuuuuuuuuuuuuttttttttttttttttttttsssssssssssssssssssssssrrrrrrrrrrrrrrrrrrrrrqqqqqqqqqqqqqqqqpppppppppppppooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnmmmmmmmmmmmmmmmmmmmmmllllllllllllllllkkkkkkkkkkk...

result:

ok ok (1 test case)

Test #59:

score: 0
Accepted
time: 18ms
memory: 20260kb

input:

1
917
fzibwivwklqwhmceqbrcufokodwqockrbumzufacjbxvcrffazgyaklqadbsntouijulxncpmouvxtfrzynwtwouopromvdsxvcmsupmidmoteyzaggmofqoqdxdqugyqfbaupbdnhljmxatrjexuyoyfuxtdcehhpgvyyrcnqisxpmhzgtwuzabyejijcegfzryhchzedabdlhfxvmlnarbwfyacpyhjbymsjsekgipbquoslikbcuqdjlxiupelsvkneplbyamzjfskkuallobyvqhnnfkubxmky...

output:

YES
gzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuttttttttttttttttttttttttttttttttttttttsssssssssssssssss...

result:

ok ok (1 test case)

Test #60:

score: 0
Accepted
time: 18ms
memory: 16100kb

input:

1
489
phavtxxkgqvzvczpbtlrrjfntdrairsofbuugjvhmwdeegubzxjusondgypiutykvhocbbglqvthqhmimkllmxxvfkjrcqbndwfocgrkkiazoxqeadpadtjmkzugvivrdhyzimkypgqeufbqazkxlqkjilrutfrxfilhyczthdqkwyaacvwksmzcaeiwzodmhyxjzykmbspzpqcbukilmacwlyollvytifwaaujuyyazciwyycccwbshvmcxyrpebvzjzkbcmllochvttbukizrtauroifguaivphd...

output:

YES
azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuutttttttttttttttttttttt...

result:

ok ok (1 test case)

Extra Test:

score: 0
Extra Test Passed