Problems
Names and characters
Names and characters
Given names of $n$ people (numbered from $1$ to $n$ in the given order), where each name is written on a separate line.
Your task is to answer $m$ queries of the form $"A\:B"$, where $A$ corresponds to the number of the person and $B$ to the index of character of the persons' name.
For each query, print a single character corresponding to character of the person's name.
\InputFile
First line contains number of people $n\:(n \le 10^5)$ and number of queries $m\:(m \le 1000)$. Each of the next $n$ lines contains one name and can be up to $10^5$ characters long.
Each of the next $m$ lines contains two numbers $A\:(1 \le A \le n)$ and $B\:(0 \le B$ < length of the name of a person number $A)$.
It is known that there won't be more than $10^7$ characters in the input.
\OutputFile
For each query $"A\:B"$ print a single character corresponding to character of the person's name. Print all characters in one line.
Input example #1
3 5 Alice Bob John 1 3 2 1 3 2 3 3 1 0
Output example #1
cohnA