#K3926. Minimum Travel Times

    ID: 26381 Type: Default 1000ms 256MiB

Minimum Travel Times

Minimum Travel Times

You are given n parks numbered from 1 to n and a list of travel tasks. Each task consists of two integers, a and b, which represent a travel request from park a to park b. The time required to travel from park a to park b is defined as \(|a-b|+1\) minutes.

Your task is to compute the minimum travel time for each task. For each query, output the computed travel time.

Note: Even if the starting and destination parks are the same, the time taken is 1 minute.

inputFormat

The first line of input contains two integers n and m where n is the number of parks and m is the number of tasks.

The following m lines each contain two integers a and b, representing a task from park a to park b.

Input is given from standard input (stdin).

outputFormat

Output a single line containing m integers separated by a space. Each integer represents the minimum travel time for the corresponding task.

Output should be written to standard output (stdout).

## sample
5 1
1 3
3

</p>