QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#343059#8234. Period of a Stringucup-team191#AC ✓199ms532156kbC++232.4kb2024-03-01 21:42:122024-03-01 21:42:13

Judging History

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

  • [2024-03-01 21:42:13]
  • 评测
  • 测评结果:AC
  • 用时:199ms
  • 内存:532156kb
  • [2024-03-01 21:42:12]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=100010, M = 5000005,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int t, n, ok;
int len[N], sum[N];
string s[N];
int fq[M][26], tmp[26];

void calc (int i) {
	if (!ok) return;
	for (int k = 0; k < 26; k++) {
		fq[sum[i]][k] = 0;
	}
	for (int j = 0; j < len[i]; j++) {
		fq[sum[i]][s[i][j] - 'a']++;
	}
	//cout << "sad na " << i << endl;
	if (i == n) return;
	
	for (int j = 1; j <= len[i + 1]; j++) {
	    //cout << "j je " << j << endl;
		if (fq[sum[i] + j][0] == -1) continue;
		int q = j / len[i];
		for (int k = 0; k < 26; k++) {
			tmp[k] = fq[sum[i] + j][k] - q * fq[sum[i]][k];
			if (tmp[k] < 0) {
				ok = 0;
				return;
			}
		}
		int pos = j % len[i];
		if (pos == 0) continue;

		//cout << "postavi uvjet " << i << " " << pos << endl;
		for (int k = 0; k < 26; k++) {
			//cout << tmp[k] << " ";
			if (fq[sum[i - 1] + pos][k] != -1 && fq[sum[i - 1] + pos][k] != tmp[k]) {
				ok = 0;
				return;
			}
			fq[sum[i - 1] + pos][k] = tmp[k];
		}
		//cout << endl;
	}
}

string reconstruct_first () {
	if (!ok) return "";
	string res = "";
	int prosli = 0;
	for (int k = 0; k < 26; k++) {
		fq[0][k] = 0;
	}
	for (int j = 1; j <= len[1]; j++) {
		if (fq[j][0] == -1) continue;
		for (int k = 0; k < 26; k++) {
			tmp[k] = fq[j][k] - fq[prosli][k];
			if (tmp[k] < 0) {
				ok = 0;
				return "";
			}
			for (int c = 0; c < tmp[k]; c++) {
				res += (char)(k + 'a');
			}
		}
		prosli = j;
	}
	return res;
}

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;
	while (t--) {
		ok = 1;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> s[i];
			len[i] = s[i].size();
			sum[i] = sum[i - 1] + len[i];
		}
		for (int j = 0; j <= sum[n]; j++) {
			for (int k = 0; k < 26; k++) {
				fq[j][k] = -1;
			}
		}
		for (int i = n; i >= 1; i--) {
			calc(i);
		}
		s[1] = reconstruct_first();
		if (!ok) {
			cout << "NO\n";
		} else {
			cout << "YES\n";
			cout << s[1] << '\n';
			for (int i = 2; i <= n; i++) {
				for (int j = 0; j < len[i]; j++) {
					s[i][j] = s[i - 1][j % len[i - 1]];
				}
				cout << s[i] << '\n';
			}
		}
	}
	return 0;
}




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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 7020kb

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: 1ms
memory: 6852kb

input:

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

output:

YES
abbbbbccccdddddee
YES
dc
d
d
YES
ccddee
YES
cced
cce
NO

result:

ok ok (5 test cases)

Test #3:

score: 0
Accepted
time: 61ms
memory: 41936kb

input:

100
147
ababbbaaaaaababbbbbaabaabbbbaaaababbbbababaabbbbaaabbabaaaaaabbbbaabbaaaaaababbbaabbabbaaabbbaabbbabaabbbbaabaabbaa
aaaaabbbbababababbbaaaaaabaaaaabbaabaabaaababbabbabbabbaabbaaabbaabbaabaababaaabbababbbbbaabaaaaabbbbaabbbbbbaaabbbbabaababbbbb
ababbabaababbbbaabbbbaaabbabaabbaaaababbbabbaaab...

output:

NO
YES
baaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbb
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: 54ms
memory: 29348kb

input:

100
326
decadadcaaacaaeecaddaeadeadc
aaadedcaaeaaeddddaeaceaddaaaaecccaaeadeaaedaccdddcdddaaaadddacceaaadcadaeeeadeeadccdaacadaaecaedadcaaaecdaddaeaaaeccdedaceaaaacdddcecdcdacddccecaaaeaeedacaeaadaaacdadedae
acaecaaaedcdaceaaddddaaeaddccdaeaadaeedaecdacaadeeaadeceadacdadaccdaaedaddccaceea
ddccacdcea...

output:

NO
YES
ebccdeabb
ebccde
ebccd
ebccdebccdebccdebccd
ebccde
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: 51ms
memory: 40900kb

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
acgbacmikmfaaddehiibfjkacaaaaaabbbbbbcccccccccdddddeeeeeeeeeeeeefffffffgggggggghhhhhhiiiiiiiiijjjjjjjjkkkkkkklllllllmmmmm
acgbacmikmfaaddehiibfjkac
acgbacmikmfaaddehiibfjkacacgbacmikmfaaddehiibfjkacacgbacmikmfaaddehiibfjkacacgbacm
acgbacmikmfaaddehiibfjkacacgbacmikmfaaddehiibfjkacacgbacmik...

result:

ok ok (100 test cases)

Test #6:

score: 0
Accepted
time: 59ms
memory: 28696kb

input:

100
512
tecvaycvrbprboqldxlzjmlbfxaseuomtjxenfyoxkmjqkifjpacqytpxmbxleryljfxeoghwfhcnhvimgkvdwjcwatlppmwbbygdbiyzvlrfqjmdnuioulrgmwfkutwgavesanvdzbypveznnvrddujscaekxauxwi
nqmlelkfqrvjbwdlvtbzxkd
kbdqfbqxqqvmkllqltebqmlrnxvxflkzedrmbwknzltfbllqllbwllwqrvkzmrdqlldvnfbkqxbdkewxrzbbndvfqrnfklllxxkvqkjf...

output:

YES
vzxjrblkeqmvnftqbdkdllwaaaaaaaabbbbbbccccccdddddeeeeeeeffffffggggghhhiiiiijjjjjjjkkklllllmmmmmmmnnnnnoooooppppppqqrrrrrsssttttuuuuuuvvvvvvvwwwwwwxxxxxxxxyyyyyyyzzz
vzxjrblkeqmvnftqbdkdllw
vzxjrblkeqmvnftqbdkdllwvzxjrblkeqmvnftqbdkdllwvzxjrblkeqmvnftqbdkdllwvzxjrblkeqmvnftqbdkdllwvzxjrblkeqmvnftq...

result:

ok ok (100 test cases)

Test #7:

score: 0
Accepted
time: 44ms
memory: 11200kb

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
hiydpy
hiy
hiyhiyh
hiyh
hiyhhiyhhiyh
hiyhhiyhhiyh
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: 44ms
memory: 9092kb

input:

10000
21
uiutbnjregblkwbpztgdbmahtlhe
dtulrltbnbtlbggtwmteiwzbejzdlzbtbutiapwhnurumbnutkekbjehanphbhrn
unt
tnnntktntttttnttutnuuuuuunntuuuntununutnntuttunuutttntnuntnuuntuttunnuututuntuttntnunntuntnnuuttutunuunnunuutnuuutnutnutnnntntntunnttntuuttnnuunnnnuuutntn
uttnnnntuuuutututtnttuutuuttnnnnntunnu...

output:

NO
YES
y
y
y
y
y
YES
kabhlmmszgklamrcgo
kabhlmmszgklamrcgokabhlmmszgkl
kabhlmmszgklamrcgokabhlmmszgklkabhlmmszgklamrcgokabhlmmszgklkabhlmmsz
kabhlmmszgklamrcgokabhlmmszgklkabhlmmszgklamrcgokabhlmmszgklkabhlmmszkabhlmmszgklamrcgokabhlmmszgklkabhlmmszgklamrcgokabhlmmszgklkabhlmmszkabhlmmszgklamrcgokab...

result:

ok ok (10000 test cases)

Test #9:

score: 0
Accepted
time: 104ms
memory: 170380kb

input:

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

output:

NO
YES
nbjklmphbnoqrswyddehijllllqqsswcdiinooqwbabcginoppqrrrsuwxzccijnsuvx
nbjklmphbnoqrswyddehijllllqqsswcdiinooqwbabcginoppqrrrsuwxz
nbjklmphbnoqrswyddehijllllqqsswcdiinooqwbabcginoppqrrrsuwxznbjklmphbnoqrswyddehijllllqqsswcdiinooqw
nbjklmphbnoqrswyddehijllllqqsswcdiinooqwbabcginoppqrrrsuwxznbjkl...

result:

ok ok (10 test cases)

Test #10:

score: 0
Accepted
time: 85ms
memory: 230224kb

input:

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

output:

YES
fzgxrfijqtwaaaaaaabbbbbccccccccccddeeeeeeffffffffgggghhhhhiijjjjjjkkkkllllllllmmmmmnnnnnoooppppppqqrssssssstuuuuuvvvvvvwwwwxxxxxxyyyyyyyzzz
fzgxrfijqtw
fzgxr
fzgxrfzgxr
fzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrfzgxrf
fzgxrfzgxrfzgxrfzgxrfzgxr
fzgxrfzgxrfzgxrfzgxrfzgx...

result:

ok ok (3 test cases)

Test #11:

score: 0
Accepted
time: 132ms
memory: 521368kb

input:

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

output:

YES
rljdbabeajwohmz
rljdbabeajwohmzr
rljdbabeajwohmzrrljdbabeajwo
rljdbabeajwohmzrrljdbabeajworljd
rljdbabeajwohmzrrljdbabeajworljdrljdbabe
rljdbabeajwohmzrrljdbabeajworljdrljdbaberljdbabeajwohmzrrljdbabeajworljdrl
rljdbabeajw
rljdbabeajwrljdbabeajwrljdb
rljdbabeajwrljdb
rljdb
rljdbrljdbrljdbrlj
rlj...

result:

ok ok (1 test case)

Test #12:

score: 0
Accepted
time: 12ms
memory: 7696kb

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
dimoopvxyz
dimoopvxyzdimoop
YES
lciorsuvx
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
bcccdefggijkklmnnnoppprsttuvwwxyy
NO
YES
cghijkkkllnnpqqrtvwwz
YES
aadellssvw
YES
dy
dyd
d
d...

result:

ok ok (10000 test cases)

Test #13:

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

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
ikmoqquz
NO
YES
fduvcz
fduvczfduv
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
abbbcccccccccccdeeeefffgghhhiiijjjjjkklllmmmmmmnnnnoooopppppqqrrrrssttttttuuuuuvv...

result:

ok ok (10000 test cases)

Test #14:

score: 0
Accepted
time: 10ms
memory: 7656kb

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
aaaabbccddddddeefggghhhiiiiiijjkkllmnnnnoooppqqrrssttuvvvwwwxxyyz
YES
erz
erzerz
e
eee
eee
eeeeeeeeeeeeeeeee
eeeeeeeeeeeeeee
eeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeee
eeeeee
eeeeee
eee
eee
e
NO
NO
YES
u
u
u
u
u
u
u
YES
kiims
kiimskiimskiimskiimskiimsk
kiimskiimskiimskiimski
kiimskiim...

result:

ok ok (10000 test cases)

Test #15:

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

input:

10000
3
aabbabbbbabaaaaabbbaaabaaaaaaa
baabababaabaaabaabbaabaababaaaaaaabaaaaaabbaabbbaaabaaaababaaabbaaaaaaaaababbaaabaaaababaaabbbbaababaaaaaaaaabbaaabbbaabbaaabaaaaaabbabbaaaaabaabbaaabaaabaaabaabaaabbabaabaabbaabaaaababababaabbaababbabbaaaabbabababbbbbaaabaaaabaabbbbbaaabaaaaaaaabbaaabaaabaaaba...

output:

YES
aaaaaaaaaaaaabbbbbbaaaaababbbb
aaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaababbbbaaaaaaaaaaaaabbbbbbaaaaab...

result:

ok ok (10000 test cases)

Test #16:

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

input:

10000
5
lzmafakuzucfezeldfgsdytjfomzjcfovbdvmagqfuqpwyrxarcgqks
cuszpkqzglakwledzoruucgeqmrfyfoymxvfvfjagazcjdsqfabfmdt
jkeqogazgzuduffffmkefslrfwuz
lkufefzqrzqkafqoffuwzwfrgljsrfuzsdugkfmdoedzzeuegfeufmkjfugffafk
zfzeugdzjaefukgudamlmuufjlufruzjkdojfkgufeuwukzqwlfaqfuogqezzsfrkkukkfadezfgozfffsfoff...

output:

NO
YES
bbbccefffghhiijjkkklllmmmoooppqqqrrstttuvwwyzaaccccddeeeffikmmmnoopqqrvvwwwxxyyy
bbbccefffghhiijjkkklllmmmoooppqqqrrstttuvwwyz
NO
YES
esaabceehhhhjknrsvvvwwxbb
esaabceehhhhjknrsvvvwwxbbesaabceehhhhjknrsvvvwwxbbesaabceehhhhjknrsvvvwwxbbes
esaabceehhhhjknrsvvvwwxbbesaabceehhhhjknrsvvvwwxbbesaab...

result:

ok ok (10000 test cases)

Test #17:

score: 0
Accepted
time: 79ms
memory: 11732kb

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: 71ms
memory: 11688kb

input:

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

output:

YES
jjxacjyzxpvzlydmgolvefrrttwoouwhj
jjxacjyzxpvzlydmgolvefrrttwoouw
jjxacjyzxpvzlydmgolvefrrttw
jjxacjyzxpvzlydmgolv
jjxacjyzxpvzlydmgolvjjxacjyzxpvzlydmgo
jjxacjyzxpvzlydmgolvjjxacjyzxpvzlydmgojjxacjyzxpvzlydmgolvjjxacjyzxpvzlydmgojjxacjyzxpvzlydmgolvjjxacjyzx
jjxacjyzxpvzlydmgolvjjxacjyzxpvzlydm...

result:

ok ok (1000 test cases)

Test #19:

score: 0
Accepted
time: 98ms
memory: 28304kb

input:

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

output:

NO
YES
aaaabbaabbbbbabaaaabaaaabaaaaaaaaaabbbbbbbbbbaaaaaabb
aaaabbaabbbbbabaaaabaaaabaaaaaaaaaabbbbbbbbbb
aaaabbaabbbbbabaaaabaaaabaaaaaaaaaabbbbbbbbbba
aaaabbaabbbbbabaaaabaaaab
aaaabbaabbbbbabaaaabaaaabaaaabbaabbbbbabaa
aaaabbaabbbbbabaaaabaaaabaaaabbaab
aaaabbaabbbbbabaaaabaaaabaaaabbaabaaaabbaa...

result:

ok ok (100 test cases)

Test #20:

score: 0
Accepted
time: 99ms
memory: 32784kb

input:

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

output:

YES
aaeecbabccacccaabaaedddeaccceeeaaaaaaabbbbbcccccccdddddddddeeeeeeeeeeeeeee
aaeecbabccacccaabaaedddeaccceee
aaeecbabccacccaabaaedddeaccceeeaaeecbabccacccaabaaedddeaccceee
aaeecbabccacccaabaaeddde
aaeecbabccacccaabaaedddeaaeecbabccacccaabaaedddea
aaeecbabccacccaabaaedd
aaeecbabccacccaabaaeddaaeecb...

result:

ok ok (100 test cases)

Test #21:

score: 0
Accepted
time: 81ms
memory: 32864kb

input:

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

output:

NO
YES
tpqvnumazibxxszfonpkdkciapabccccdddefffggghijjllmmmnnnooqqrrrsvwxxyyyzzzjmnorraaaaaaaabbbbbbbbcccddddddeeeeeeeffffffffggggggggghhhhhhhiiiiiiiiiiiiijjkkkkklllllllllmmmmmnnnnooooppppppqqqqqrrrrssssssssssstttttuuuuuuuuvvvvvvvvvwwwwxxyyyyyyyzzzzzzzz
tpqvnumazibxxszfonpkdkciapabccccdddefffggghijjl...

result:

ok ok (100 test cases)

Test #22:

score: 0
Accepted
time: 150ms
memory: 226836kb

input:

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

output:

YES
aabaabbabbbbaabbaabaaaaaabbaaabbbbaaaaaabbbbbba
aabaabbabbbbaabbaabaaaaaabbaaabbbbaaaaaabbbbbb
aabaabbabbbbaabbaabaaaaaabbaaabbbbaaaaaabbbbbbaabaabbabbbbaabbaabaaaaaabba
aabaabbabbbbaabbaabaaaaaabbaaabbbbaaaaaabbbbbbaab
aabaabbabbbbaabbaabaaaaaabbaaabbbba
aabaabbabbbbaabbaabaaaaaabbaaabbbb
aabaa...

result:

ok ok (10 test cases)

Test #23:

score: 0
Accepted
time: 126ms
memory: 105660kb

input:

10
3928
ryebddpjljiukrikjtylkpbwsyicayhhc
yrtckcaijkhutpjrlpiyyppkbwicdklyiydrdbiihlyybkcesjb
tkkdahhldwkpisyypjbyiicerccbjuljpyrkdil
ilypujtjbckirykdhlcybkpi
yjtphkbpkriiykkbjiccucdyll
tybkjirukdiipbjiulciryyyupjklkrypcddkylkckcirhlkibyyjpkdjilkkjkcpkcpyyyjcpklpbiucihtyitiulckbbcjkycpjybklicbplykcb...

output:

YES
ckdilpcyykbyibitrphlkujjadehjrswy
ckdilpcyykbyibitrphlkujjadehjrswyckdilpcyykbyibitrp
ckdilpcyykbyibitrphlkujjadehjrswyckdilp
ckdilpcyykbyibitrphlkujj
ckdilpcyykbyibitrphlkujjck
ckdilpcyykbyibitrphlkujjckckdilpcyykbyibitrphlkujjckckdilpcyykbyibitrphlkujjckckdilpcyykbyibitrphlkujjckckdilpcyykbyib...

result:

ok ok (10 test cases)

Test #24:

score: 0
Accepted
time: 155ms
memory: 521960kb

input:

1
100000
abbaabbaaabbbbbbbbbbbabbabbbbbbaabb
bbabaabbbabbbbabbbbbabbbbbbbabbabababbaabb
ababbababbbaaabbaabbbbaabbbbabbbbbbbbbbbbbbbbbabababaabbabbbbbaaaababbbbabbbbbbbbbabbbbbbbbabbbbbbbbbaabbbbbbbabbababbaabbabbbabbbbabbbabbbaabababbabbbbbababbbabbabbbababbabaaabbbbbbbbbb
babbabaaabbbbbbaabbbbbabb...

output:

YES
abbbbababbbbabbbbbabbbbbbaaaabbbabb
abbbbababbbbabbbbbabbbbbbaaaabbbabbabbbbab
abbbbababbbbabbbbbabbbbbbaaaabbbabbabbbbababbbbababbbbabbbbbabbbbbbaaaabbbabbabbbbababbbbababbbbabbbbbabbbbbbaaaabbbabbabbbbababbbbababbbbabbbbbabbbbbbaaaabbbabbabbbbababbbbababbbbabbbbb
abbbbababbbbabbbbbabbbbbbaaaab...

result:

ok ok (1 test case)

Test #25:

score: 0
Accepted
time: 141ms
memory: 522192kb

input:

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

output:

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

result:

ok ok (1 test case)

Test #26:

score: 0
Accepted
time: 99ms
memory: 521956kb

input:

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

output:

NO

result:

ok ok (1 test case)

Test #27:

score: 0
Accepted
time: 134ms
memory: 521976kb

input:

1
100000
ihuppckdjjsbspctuttc
dbpsibscpcjpsjktcpbscpubjstupjcuutkpchsitjpsbbhtdktcccdhkjhcpcutskujpcsptjptssiupjpuuhtipttuicipdhsdjctpdbtjutptppupjtcctthtupcjskpcbcsdsjjputckujcicschhtttkducpcji
hpjiktthjjssbkcdbuucttppscupkjtptcuscppbddicjpcuths
cjbkpuphsctpjuscthbhditipcpdputtcuspsjbtjpthckkcjdttp...

output:

YES
jchpkpbdstucpicsjttu
jchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstucpicsjttujchp
jchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstu
jchpkpbdstucpicsjttujchpkpbdstucpicsjttujchpkpbdstujchpkpb...

result:

ok ok (1 test case)

Test #28:

score: 0
Accepted
time: 135ms
memory: 520608kb

input:

1
50000
wpmbctmpdufpqucxpynbxleqtnvnmahajofjenodxqdmtvhjgxkaalzqgvamarwjbjytsgehjgrbqawyhoujwlobjlpyqwl
ojapjpjpcqwxhghmvnenmugwwxtjoeanuleahdbnhotmkalrqmcojwwtljbonuyaxbyqfwgpgqcjnlrqmpaquxlyldatvyspqpjqybdhxvadqjobzfbwuqxahru
xhanwqbwppqryeoahgoxlqmuhmxpwmquyjxwuhcadnjl
uywucuoahwwqxaneyywaxonenml...

output:

NO

result:

ok ok (1 test case)

Test #29:

score: 0
Accepted
time: 107ms
memory: 520644kb

input:

1
50000
muzrveujbtkgwktuzfsuuclmecucfpmkhmlqzbydnagqedywghjhzhtxaow
tbhgfwqluyzzwkbmasuwqphjoalumuwfunuaezbhcuwkkceduufmdztgtbvmzgtjcuqpcrulrzzwtecxhkugzemxmgyyhdmjmyh
bmerqmqhzuftbcajtfxrtymwyzhuuulkdwnqmwywhzevgauhgaxmczwzmulcgybgzudzodusphblekmjkcpuktfw
jfdwbfzawqqrmlckwlmmkcjzudwbhpmggdkuwwtrfpx...

output:

YES
cyumwukymlzxmrabpqdhwgzzbwuftcjmethuzguuacdeefghhjkklnoqstv
cyumwukymlzxmrabpqdhwgzzbwuftcjmethuzguuacdeefghhjkklnoqstvcyumwukymlzxmrabpqdhwgzzbwuftcjmethuzguu
cyumwukymlzxmrabpqdhwgzzbwuftcjmethuzguuacdeefghhjkklnoqstvcyumwukymlzxmrabpqdhwgzzbwuft
cyumwukymlzxmrabpqdhwgzzbwuftcjmethuzguuacdeefg...

result:

ok ok (1 test case)

Test #30:

score: 0
Accepted
time: 71ms
memory: 532156kb

input:

1
100000
tfachkqbvxppacinlodgymgniazuyyozoreheehctbqzrezzvclzzetgtyxdcbqfvegqkqrzwwajisqixlzccdgxqeqcfsqvinarlgefiyxgscymzuyqaknbhotzatiqrcmpwxetjypqbrqovslhnnnifpacwcufuztsbvrfxcvmopnccqlpskhkaqxmrutqnlcvdwrmtfyvtqokwzhwzsajzkviwqdyocyejcuggusnlqgbjeyiofhzgkxsushlnlnwafrkdhdbghipwehuzzgvhkftklqslwj...

output:

YES
maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #31:

score: 0
Accepted
time: 80ms
memory: 532000kb

input:

1
100000
bysvohgnpqvgsdmjhujfbckrqoedifrmfcfafxmvnmcnghjxlejplurbbpmuqjzciezjzjzkkpyfaoxpnaymxoktxcndgqjumjerxlkbsrzviiiawaufrjtunrkfbrjjkeuibhfgpxtwoxowlznpiaypuyucfhakanfhhkxfqhldgphxkmzgcqdbabbiexarsmegtqllxeerrnwzegiqzcbhnuldiigxjttvukbsfyxqytebpylyfpmdusyiohfugynrgvvnnymwrtekniykkebojcnmljsbwmy...

output:

YES
juaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #32:

score: 0
Accepted
time: 81ms
memory: 531764kb

input:

1
100000
rrkuldhnwpyskfchbilaycnjdlqtucuxuawqgqrsgygdoqfwuwuyqwfrwumczjzrbceapbumhyyivsmyriojbhigmbwmcpcebixforynxzuajlqkyzhvbxgsfztsdexrhlqelgbajszxbltofwgsxylxzgdsyhclwvmhpritxffbevbidtietbqosejqydkvyungntfuynbflfukzenfgvdfddftwnuyifpahxrkwkpmszbqnmvpehycwnexkteswavtxszupxfzsmnplbylmnomkeryrjrzqlp...

output:

YES
cdfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #33:

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

input:

1
100000
dkupibsvytfhbpiopkcbqhttgqbvwhcxhpsslrjdbpziobtjlnaapmgucenyjqvrnknlnonmprpbjvqucnvglogqphcirlsjwgrbcxxceherupuexdgmzuhltrrekigaaaoizaehsifuvzioukwrjqblkdhlwasslcylzjlodbnaanuchomlmeawyytiqclnmbmdfmqukgegffoliexckahthrpyjdooxhdfobnrrnalquibgamqquvciyuxrvtjlncciowaddxnzmdcpjlhrnizhoyctigzyfp...

output:

NO

result:

ok ok (1 test case)

Test #34:

score: 0
Accepted
time: 44ms
memory: 519496kb

input:

1
100000
tkdjkxwxkjhggjxsnyztngomawuxbhglrpqfrupopxvhgfwwbcvchsoibhdunnhrujjlerjpakfdsovngtknepnvbgktfldzxvujutjykuhrnrvmtgvoznkzoyveqrtenqnevomphdjhoewfctsecybjixonmdrxmdlpxlyroxezbzinrluniaykkbcyhubdyrvewcoijesqohhqsjkccepvjvcapjbrtckeuoysbezinafwndwqcmprdoufoxntcfbjabwwtlfncauyzrmwxdkyrepeujbeucz...

output:

NO

result:

ok ok (1 test case)

Test #35:

score: 0
Accepted
time: 76ms
memory: 519812kb

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: 80ms
memory: 519852kb

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: 75ms
memory: 519496kb

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: 75ms
memory: 519380kb

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
rsgwkqbgk
rsgwkq
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: 99ms
memory: 519704kb

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
tjjbtzclkkrx
tjjbtzcl
tjjbtzcltjj
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: 59ms
memory: 521812kb

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: 110ms
memory: 531260kb

input:

1
100000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #42:

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

input:

1
100000
aabbaaaabaabaabbabbababaabaaabbaabbabbaabbbaababababbbaaabbabaaaabbbaabbbababbaaabbaaaabaabbbabbabbabaaabbbbaabababbbaaababbbbbbbabbbbbaabbabbaabaabaababaabababbabbbabbaabbbbaabaababbbabbaaaabaabaaaababbaaababaabbbaaaabaabbaabbaaababaabababaaaaaabaabaabababaaabaaabbbaaaabaabaabaaaabbbbbabaa...

output:

YES
baabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #43:

score: 0
Accepted
time: 187ms
memory: 520004kb

input:

1
3162
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #44:

score: 0
Accepted
time: 176ms
memory: 519844kb

input:

1
3162
bbbbabbababaabaabaaabaabaabbbaaaabbbabbabbbaaaaababbbbbbaaaaaabbaaaabaaabaabbbababbbabbaabaababaabbbbbbbbaabbababbaaabbaababbbaaaabbbbbbbbabaaaabaaaababaaababbbbabbbbbbbbbbabbbabbabbbbbabbabababaabbaabaabaaaabbabbbbaabbbabaaabaabbaaaaababbabbbbbbaabbbbbaabbbbabaaaaaaaaabaabbabbbaabaabaaabaaba...

output:

YES
abababaaaaabaabbabbbaaaabbbabbabbbaaabaaaabbbbaabbaaaabaabbaaaaaababbbaaaaabbbbbbbabbbaaabbabbaabbbbbabbbabbbaabaabbbaababbbaaabaaaaababaabaabbaaaabbbabaaaabbbbabbababaababaababbabbaaabbbbbabbabbaaaabbaaababbaabbbaaabaaabaababbbaabbbabbaabbabbbaabbabaabaaababbbababbbbaababbbabaabbbbbaabbaabababa...

result:

ok ok (1 test case)

Test #45:

score: 0
Accepted
time: 180ms
memory: 519836kb

input:

1
3162
nuxkmfvlestahpxpfaprpidolroqeztqakhbkgsaspmfgntzwevlgpwgrjhfdqqqdudhqnjheltstzosigqrvbpxuwmbgmdieihfxcdfooleleoxnmsefqiqtnzqjvovdfdrwijcxkuogocffxlfuejjjdbtwhcnennlytynndnvcbroijlbpbksgpuqvoyiqptuueuuxkmdmfmjdmlkulppcwzbmdauukvpgsptqcunkfhftczygkxhjinaurnilylzvfssitnjntnweqrczhvkmzpqzkyvzxbul...

output:

YES
fznlnvkbxozdqwexgirpqpiiluzqfmsrrxjdjibhuaypszukfjrxpjplcheozuebhgohmglanruldhvegralifrpmpdqalrckzbksbvevcmlivzarcyjifeocmrjalrubdxlkzswmsebrvzpmkwgymreixtavscbaygfdhgzbsgmohavzcpiegovepjvvlqcfoyesarlcegiizqtidraooxieofclpacojcsngwchmemeplfplifofxkueqswsfclitdchqpbdymcxwpbahbilfhkydcougieqhwegdd...

result:

ok ok (1 test case)

Test #46:

score: 0
Accepted
time: 199ms
memory: 519664kb

input:

1
4472
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #47:

score: 0
Accepted
time: 174ms
memory: 519788kb

input:

1
4472
ababaababbaabaabaababbabaaabbaaaabbaaabbabbabaabbbbbbabbaabbbabaabaabbaaabaaaabbaabababbaabbbbbbaaabbababaabaabaabbaabbabbaabbabaaabbbbbbbaabbaabbabaabbbaaaabbabbaaabaaabbbbbbbbaaaaaababababaaabaaabbaaaaaaaaabbaaabbabbaabbbbabbbababbbbabaababbbbaaaabaabbbbbabaaabbbabbbbaaabbaaaababaaaabbabaab...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok ok (1 test case)

Test #48:

score: 0
Accepted
time: 182ms
memory: 520008kb

input:

1
4472
ebjvyazjaqkhfirvcnnbupxkcjfsoooulwvdvjfxnyelfcvhmgjmgxvpozhnwwhajfusradoixqfdizjyydatecqxnqzpbaoeboucsjpxwdwtsqhklpecwharpqrwkkvjbmzhnrahxnbykhhrmacremhjcdytpbempsdhvxashnqrnetspfkubirisesvcodkmacihtwutqlfijcvaphjvffmwlgtmdlhiytiusedkltxkvahrfddhjgncgxjmkmwvkysqfjxkomxzxmizvhuxmcpcaxqeomwbkdi...

output:

YES
faaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffff...

result:

ok ok (1 test case)

Test #49:

score: 0
Accepted
time: 173ms
memory: 519712kb

input:

1
4245
baabbabaaaaaaaabaabbababbbbaaababababbbbbaabbaababbbbaabaaaaabaaabaabaaabbbbabbaabbabbababbbabbabbbbbbabababbbbbbaaaababbaabbaaaababbabbabbbbabaababbaaaaaabbbaababaabaaabbabaaabaaabaabbbabbaaaaaabaabbbabbbaaabababaabbabababaabaaabaabaabaaaaaaabaabaabbaaaabaaabaabaabaaaaabbabaaaaabaabbaaababbb...

output:

YES
bbaababaaabababbbabbbbbabaaaababababbaababbaaabbabbbababaaaababbbbabbbababbaaaababbbaabaababbabbbaaaabbabbbabbaaaababababaabbbbbbaaababaabaaababaabababbbababbbbabbabaabaaabaaabaaababababaaabbbaaaaabaabbbbbbbababbabababbaabaababaabbbbaaababaabbaaabaabaabbbbaaabababbbaabaaabaaaabaaaaaabaaabaaaabba...

result:

ok ok (1 test case)

Test #50:

score: 0
Accepted
time: 176ms
memory: 519940kb

input:

1
3501
abbbabababaaabbbbbbbaaababaabbbaaaaabaabbababbabaabaaaaaababbbbbbaaaaaaabbabababaabaaabbabbbbbbaabababaabbbaaaaaabaaabbaaaabbbabaabbababbbaaaaaabbabaababbbabababbabaabbbaabababaaaaaaaaaaaabbbbbbabbabbabbbbaaaaaabababbabbbbaaababaabaaaaabbaabaabbbabaaabbbbaaaaaaabbbabaaaaabaabbaaababbbbabbabaa...

output:

YES
babbabbbabaaabbabababbabbaabbabbbbbaabbbaaaabbaabaabaaaabbbbbbaabbaaaababbbabbabaaaaababbaabbabbaabbbabbbbbbaabbbbabbbaaaabbbbbbbbbbbababbabaaabbbabaaababbbabaaaabbaabbabbbaabaaaaaaabaabaaaaabbbbaaabaabbaabaabbabbaaababbbaaababaaaabaaabbbbbbbabaabbbbaaaabbbbabbaaaababaaaaaaaabbababbbabbabaaabaaa...

result:

ok ok (1 test case)

Test #51:

score: 0
Accepted
time: 190ms
memory: 519800kb

input:

1
3266
aaabbaabbabbabaababbbabbbbbbabbbbbbbbbbbbabbbaaaabababbaaabbababbaaababbbbbbaaabbaabbaaaaaaaaababbbbaaabbbbaaabbabbbbbabaaabbabbbbbbaababbbababbababbbbbabbabbbbabbabbaaabaaabbbaabbbbaaabbbbaabbbbabababababbabbbaabbbbaababbaaababbbbaaaabaaaabaaaaaaabbaaabaaaabbaababbbaaaabbabbaaaabababaabababa...

output:

YES
bbbabbaaaabaabbbbbbabaababbbbababaaaaabaabbbaabaababaabababaabbaaabbabbbbbbbaababbaaabababaabbbbaabbbbabbabbabaabaaabbaabbbaaaabbbbbababaabbabbaaabaabbbaabaabbaabbabbbaabbbbabaabababbaaabbabbababbaaaabaaaaaabbaabbabaabaaaaabaabbaabbabbbabaabbbbbbaaabbbbbbaabababbabbbabaababbbbaaaaababaababbaabaa...

result:

ok ok (1 test case)

Test #52:

score: 0
Accepted
time: 190ms
memory: 519796kb

input:

1
3182
bbaabbabbbaabbbabbabaabbaabaababbabbbabaabababbbbbbaaaabaabababbabbbaabbbbabbaabababaaabaaaaaabbbaaaaabababaaaabaaabbbaabaabaaaaabaaababbbbabaaaabbbbaaabbbbaaabaabbababbbaababaaaaabbabababbabaabaaaababbabaaaabbabababaaabbbbbbbababbbaaaabbbabaabbbbbaaababbabbbbbbbbbaabbaabbabbbbbaaaabbaaabbbaa...

output:

YES
abaabaabababbbaabbaaaaaabbbabbabaaaabbabbbaaababaabbababababbbabaaaaabbbaaabbabbababbaaaabbbbbaaabaabaaabaaaabbbaabaabbbbaabaaaaabaababbaaaabbbbabaabaaaaababbbbababaaaaaaabbaabbbaaabbbaabaaaaaababbbbbabaaaaabbbabaababbabbbaaabbbabaaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbba...

result:

ok ok (1 test case)

Test #53:

score: 0
Accepted
time: 79ms
memory: 519764kb

input:

1
3114
dqtpwgqrbmryzxhxhhvkgfxkahfoklpjybeyargraoznegtxjf
towkjgqkhtrkfyxqxygafjhpprorbvadzymebjhhfeglxgznxra
knexjjrzkayothdbfawovlhytzgegjphghxfrayrbxfqqkrpjgmx
jxaggxxaqejhnrrdvtmrlhhzozbkyjegryqabtwfpohjypxjfkgkf
ktyqxpylexbkrerhxjongywdzrxhrfzjvojjaabpjghhmfgtqkfagj
bzrgrqwfnkkpggxjxyjajlkbypve...

output:

YES
jaaabbdeefffgggghhhhjkkklmnooppqqrrrrttvwxxxxyyyzz
jaaabbdeefffgggghhhhjkkklmnooppqqrrrrttvwxxxxyyyzzj
jaaabbdeefffgggghhhhjkkklmnooppqqrrrrttvwxxxxyyyzzjj
jaaabbdeefffgggghhhhjkkklmnooppqqrrrrttvwxxxxyyyzzjjj
jaaabbdeefffgggghhhhjkkklmnooppqqrrrrttvwxxxxyyyzzjjjj
jaaabbdeefffgggghhhhjkkklmnoopp...

result:

ok ok (1 test case)

Test #54:

score: 0
Accepted
time: 75ms
memory: 519544kb

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: 72ms
memory: 519768kb

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: 67ms
memory: 519536kb

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
hmt
hmth
hmthh
hmthhh
hmthhhh
hmthhhhh
hmthhhhhh
hmthhhhhhh
hmthhhhhhhh
hmthhhhhhhhh
hmthhhhhhhhhh
hmthhhhhhhhhhh
hmthhhhhhhhhhhh
hmthhhhhhhhhhhhh
hmthhhhhhhhhhhhhh
hmthhhhhhhhhhhhhhh
hmthhhhhhhhhhhhhhhh
hmthhhhhhhhhhhhhhhhh
hmthhhhhhhhhhhhhhhhhh
hmthhhhhhhhhhhhhhhhhhh
hmthhhhhhhhhhhhhhhhhhhh
hm...

result:

ok ok (1 test case)

Test #57:

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

input:

1
3114
qzvpdpadbydbwtinrhdpqzirdcvyeryggcgvxdxwsekdtiquzm
kqtvmzgcrxsdvpbvgrgeypzicedhydbiwazxpyirzndwdddutqq
zzxrihucybvtgvptdixgdgvzecrdpdddynzsdrmqqykbawqpzewi
tdptvwzeschyzcrziypizrgvreqqkzxddwbpmngddqvbadyzxiudg
iqgcqidmbrepqizdytdugvzbyatzdpgevdcdxrvxkdwnpzzswhzyrz
gddirbwuiydzernqamqdpycgqxtd...

output:

YES
zabbccdddddddeeggghiiikmnpppqqqrrrsttuvvvwwxxyyyzz
zabbccdddddddeeggghiiikmnpppqqqrrrsttuvvvwwxxyyyzzz
zabbccdddddddeeggghiiikmnpppqqqrrrsttuvvvwwxxyyyzzzz
zabbccdddddddeeggghiiikmnpppqqqrrrsttuvvvwwxxyyyzzzzz
zabbccdddddddeeggghiiikmnpppqqqrrrsttuvvvwwxxyyyzzzzzz
zabbccdddddddeeggghiiikmnpppqqq...

result:

ok ok (1 test case)

Test #58:

score: 0
Accepted
time: 60ms
memory: 519548kb

input:

1
2702
mxzrvoigikocbftgdijbvzqbkzhyydmqkyybrveuhbujiyjotmsekzxhwximyxunmkeinompecldkudepqcobaahquotkxbhwuonaisauzhrujslcssvuilfxbdgdqxrbammvklwinzzixqztrifpszorvvihcxthcmshpuqjvexrngdgeouhxfikjfonytbxmnqflqmmaqirjmnkvvsxcpiejebtjhrkvkoofslqtgwrcszrchcspigupkchuanrjjlnqkjvhlgijszghegqnteifsesypeyrctt...

output:

YES
paaaaaaaaaaaaabbbbbbbbbbbbbbbccccccccccccccccccccccdddddddddddddeeeeeeeeeeeeeeeeeeeffffffffffffffffgggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiijjjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkllllllllllllllllmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnnnnnnnnnnnooooooooooooooooooooooop...

result:

ok ok (1 test case)

Test #59:

score: 0
Accepted
time: 63ms
memory: 519944kb

input:

1
917
fzibwivwklqwhmceqbrcufokodwqockrbumzufacjbxvcrffazgyaklqadbsntouijulxncpmouvxtfrzynwtwouopromvdsxvcmsupmidmoteyzaggmofqoqdxdqugyqfbaupbdnhljmxatrjexuyoyfuxtdcehhpgvyyrcnqisxpmhzgtwuzabyejijcegfzryhchzedabdlhfxvmlnarbwfyacpyhjbymsjsekgipbquoslikbcuqdjlxiupelsvkneplbyamzjfskkuallobyvqhnnfkubxmky...

output:

YES
gaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffffffffffffffffffffgggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhiiiiiiiiiiiiii...

result:

ok ok (1 test case)

Test #60:

score: 0
Accepted
time: 62ms
memory: 519956kb

input:

1
489
phavtxxkgqvzvczpbtlrrjfntdrairsofbuugjvhmwdeegubzxjusondgypiutykvhocbbglqvthqhmimkllmxxvfkjrcqbndwfocgrkkiazoxqeadpadtjmkzugvivrdhyzimkypgqeufbqazkxlqkjilrutfrxfilhyczthdqkwyaacvwksmzcaeiwzodmhyxjzykmbspzpqcbukilmacwlyollvytifwaaujuyyazciwyycccwbshvmcxyrpebvzjzkbcmllochvttbukizrtauroifguaivphd...

output:

YES
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccdddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffgggggggggggggggggggggggggggggggggggghhhhh...

result:

ok ok (1 test case)

Extra Test:

score: 0
Extra Test Passed