Billboard

Time limit3sMemory limit256 MB

Problem

At the university entrance there is a large rectangular billboard of size h × w, where h is its height and w is its width. It is used to post all kinds of announcements: upcoming programming contests, dining hall menu changes, and other important information.

At the start of the term the billboard is empty. Announcements are then posted one by one.

Each announcement is a strip of paper of unit height. The i-th announcement is a rectangle of size 1 × w_i. Whoever posts a new announcement always chooses the topmost row in which it fits, and among all valid topmost positions chooses the leftmost one.

If there is no valid place for a new announcement, it is not posted.

Given the size of the billboard and the announcements, determine, for each announcement, the row in which it is placed.

Input

The first line contains three integers h, w, and n (1 ≤ h, w ≤ 10^9; 1 ≤ n ≤ 200000) — the height and width of the billboard and the number of announcements.

Each of the next n lines contains a single integer w_i (1 ≤ w_i ≤ 10^9) — the width of the i-th announcement.

Output

For each announcement, in the order given, output a single integer — the number of the row in which it is placed. Rows are numbered from 1 to h, starting at the top. If an announcement cannot be placed, output -1 for it.