Names and characters#10245

Names and characters

1 Sekunde
128 Megabyte
Sehr leicht

Given names of people (numbered from to in the given order), where each name is written on a separate line.

Your task is to answer queries of the form , where corresponds to the number of the person and to the index of character of the person's name.

For each query, print the corresponding character from the person's name.

Eingabe

First line contains number of people n\:(n \le 10^5) and number of queries m\:(m \le 1000). Each of the next lines contains one name and can be up to 10^5 characters long.

Each of the next lines contains two numbers A\:(1 \le A \le n) and B\:(0 \le B < length of the name of a person number ).

It is known that there won't be more than 10^7 characters in the input.

Ausgabe

For each query print the character at index in the name of person number . Print all characters in one line.

Beispiele

Beispiel 1

Loading
Loading