079. Over The Rainbow
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

A color wheel is a tool used to determine the relationships of different colors, often by the distance between two colors on the wheel.

Using the given simple color wheel above, your task is to determine the shortest numerical distance between two colors.

Input

The first line will contain an integer $$$n$$$, the number of test cases that will follow. The next lines will contain two strings in each individual line, which will be the two colors that will taken under measurement. (All colors will have the same name as the colors of the image above)

Output

Return the int value of the distance between the two colors, including the last color, but excluding the first.

Example
Input
3
green red
purple orange
blue blue-green
Output
3
2
1
Note

(All inputs will be in lowercase)