favorite We need a little bit of your help to keep things running, click on this banner to learn more

2018 Цикл Интернет-олимпиад для школьников

Game in strings

While Kratos and Atreus rested from a long journey, they decided to play a game in which each player initially had to have a string of length exactly k, and these lines should be the same. Each of them had its own line, and they wondered if they could make a suitable line out of them to start the game.

Since Kratos was very tired, he decided that he would simply cut a substring of length k from his original string s with his axe. Atreus was still full of strength, and decided that he could cut any k characters from his string t and then glue them back in any order.

Help them to understand if they can start the game, or they will have to abandon this venture.


The first line contains one integer k (1k3 * 105) - the required length of the lines needed for the game. The next two lines contain non-empty lines s and t - the lines that Kratos and Artey initially had, respectively. Strings consist only of small Latin letters, and their length does not exceed 3 * 105.


If they can compose the string and start playing, print "YES". If they are not destined to start the game, print "NO".

Time limit 1 second
Memory limit 128 MiB
Input example #1
Output example #1
Source 2018 Cycle of Internet Olympiads for schoolchildren, second team season olympiad, Basic nomination, October 20, Problem H