Week 10: January 18 - 24
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.
First line contains number of people n (n ≤
105) and number of queries m (m ≤ 1000). Each of the next n lines contains one name and can be up to
105 characters long.
Each of the next m lines contains two numbers A (1 ≤ A ≤ n) and B (0 ≤ B < length of the name of a person number A).
It is known that there won't be more than
106 characters in the input.
For each query "A B" print a single character corresponding to character of the person's name. Print all characters in one line.
3 5 Alice Bob John 1 3 2 1 3 2 3 3 1 0