Problem E

Statement
Copy Copied
Description:
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.

Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".

You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$$s$$$ and $$$t$$$ should not occur in $$$res$$$ as substrings.

A substring of a string is a contiguous subsequence of that string. So, the strings "ab", "ac" and "cc" are substrings of the string "abacc", but the strings "bc", "aa" and "cb" are not substrings of the string "abacc".

If there are multiple answers, you can print any of them.

Input Format:
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) β€” the number of characters 'a', 'b' and 'c' in the resulting string.

The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'.

The third line of the input contains one string $$$t$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'.

Output Format:
If it is impossible to find the suitable string, print "NO" on the first line.

Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$$s$$$ and $$$t$$$ should not occur in $$$res$$$ as substrings.

If there are multiple answers, you can print any of them.

Note:
None

Submissions

IDLanguageExit CodeTimestampCodeStdoutStderrRetry
4644 go 0 2026-02-28T07:27:59.467223Z View View View Retry

Evaluations

Eval IDRun IDProviderModelLangSuccessTimestampPromptResponseStdoutStderrRetry
1111 20260227-140328 gemini gemini-3.1-pro-preview go false 2026-02-27T15:35:28.091148Z View View View View Retry
503 20260218-065301 vertex gemini-3-pro-preview go false 2026-02-18T07:26:01.073445Z View View View View Retry