# Queue Data Structure

# Ancient dynasties

The history of the Tatar-Mongol Khanate is rich in rulers. Each of the n rulers belonged to one of the two dynasties, and power often passed from one dynasty to another. Each ascension of the ruler to the throne was marked by a holiday held on March 26. The annals recorded years of these holidays, and it is known that the rulers of the first dynasty organised a koumiss festival for the people, and rulers of the second dynasty organised a honey festival.

At conference on the history of the Tatar-Mongol Khanate, each of s scientists proposed their own version of the interpretation of the chronicle. Namely, i-th historian argued that from each koumiss holiday until the next koumiss holiday, at least `kl[i]`

years passed, but not more than `kr[i]`

years, while from each the holiday of honey until the next holiday of honey took at least `ml[i]`

years, but no more than `mr[i]`

years.

Each proposed version can correspond to several distributions of rulers by dynasties. Scientists have agreed to consider the indicator of the doubtfulness the distribution of the number of transitions of power to a representative of the same dynasty.

Write a program that will find the distribution corresponding to at least one of the versions and having the lowest index of doubtfulness, as well as the version to which it corresponds.

## Input data

First line contains number n (2 ≤ n ≤ 200000) - the number of holidays in the annals. Next line contains integers `x[1]`

, `x[2]`

, ..., `x[n]`

(1 ≤ `x[1]`

< `x[2]`

< ... < `x[n]`

≤ `10^9`

) - the years of holidays.

Third line contains the number of scientists s (1 ≤ s ≤ 50). Each of the next s lines contains four positive integers `kl[i]`

, `kr[i]`

, `ml[i]`

, `mr[i]`

(1 ≤ `kl[i]`

≤ `kr[i]`

≤ `10^9`

), (1 ≤ `ml[i]`

≤ `mr[i]`

≤ `10^9`

).

## Output data

First line must contain numbers p and q, where p is the number of scientist, which version corresponds to the distribution with the lowest doubtfulness index, and q is the indicator of doubtfulness of this distribution.

Second line must consist of n digits of 1 and 2 without spaces, meaning the coming to power of a representative of the first or second dynasty, respectively. If there are several solutions with the smallest doubtfulness q, output any of them.

In the case if there is no way for the distribution of periods of government between dynasties in any version of scholars so that the restrictions on the intervals between holidays are violated, output the number 0.

## Examples

3 1 2 3 1 1 1 1 1

1 1 122

4 1 6 9 13 2 1 2 2 3 6 7 3 3

0

5 3 6 8 9 10 2 2 3 1 1 1 4 1 10

2 0 21212