Under construction

Still being built. Things may change

Closeness

Time limit1sMemory limit1024 MB

Summary
Decide whether two strings can be made equal by cyclically shifting adjacent letter pairs, after each of Q single-letter updates to one string.
Level

Medium5 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

One spring, on an unusually warm evening, two men appeared at the Patriarch's Ponds in M*skva. The first was the editor Mihail Aleksandrovič Berlioz. The second was a young poet called Bezdomni. Each of them had a string of length NN.

Soon the mysterious black magic specialist, Professor Woland, joined them and said:

"Gentlemen, you have very interesting strings, and I can tell at a glance whether they are close or not!"

One move picks two consecutive letters of one string and shifts both of them forward one step in the alphabet, cyclically. For example, the pair ab becomes bc, and the pair qz becomes ra. Two strings are close if applying moves to both of them can make them equal.

"Surely you are talking nonsense, Professor. Deciding whether two strings are close is notoriously hard."

"No, Mihail Aleksandrovič, you are wrong, and I will prove it! I will tell you whether your strings are close, and then you will make QQ changes to your string. After each change, I will tell you whether your strings are close."

"Very bold, Professor, truly very bold. Let us begin!"

Input

The first line contains the natural numbers NN and QQ, the length of the strings and the number of changes.

The second line contains the string of length NN that belongs to Berlioz.

The third line contains the string of length NN that belongs to Bezdomni.

Each of the next QQ lines contains a number pip_i and a character cic_i. This means that in the ii-th change, Berlioz changed the pip_i-th letter to cic_i.

Output

On the first line, print da if the initial strings are close, and ne if they are not.

On each of the next QQ lines, print whether the strings are close after the ii-th change to Berlioz's string.

Hint

In the first sample, after the change, the words are close by the following moves: abc → bcc → cdc → dec → dfd, and ced → dfd.

Examples2

  1. Example 1

    Input
    3 1
    bbc
    ced
    1 a
    
    Expected output
    ne
    da
    
  2. Example 2

    Input
    6 0
    berlio
    pjesni
    
    Expected output
    da