Description

In old train stations, you may encounter a few remaining "car changers".

在老舊的火車站,您也許會遇到少數僅存的"車箱置換員"。

"Car changers" are railroad employees whose main job is to rearrange train cars.

"車箱置換員"是鐵路部門的員工,主要工作就是重新排列火車車廂。

Once the cars are arranged in the best order, all the train driver has to do is unload the cars one by one.

一旦以最佳順序排列了車廂,所有火車司機要做的就是將車廂逐一卸下即可。

The name "car changer" originated from the first person who performed this task in a station near a railway bridge.

"車箱置換員"源自在鐵路橋附近的車站中執行此任務的第一人。

The bridge does not open vertically, but rotates around a pillar in the middle of the river. By rotating the bridge 90 degrees, ships can pass left or right.

這座橋並不會垂直打開,而是繞著河中央的一根支柱旋轉。將橋旋轉90度後,船隻就能向左或向右駛過。

The first "car swapper" discovered that the bridge could run up to two carriages on it, and by rotating the bridge 180 degrees, the carriages could switch positions.

第一位"車箱置換員"發現,這座橋最多可以在其上運行兩個車廂,通過將橋旋轉180度,車廂就能切換位置。

(The drawback is that the cars face opposite directions, but train cars can be moved either way, so no problem).

(缺點是車廂面向相反的方向,但是火車車廂可以以任何一種方式移動,所以沒差)。

Now that nearly all "car changers" have been eliminated, railroads want to automate their operations.

現在幾乎所有的"車箱置換員"都已經淘汰了,鐵路公司希望將其操作自動化。

Your task is to write a program that calculates the minimum number of times two adjacent carriages need to be exchanged in order to arrange all the carriages in order.

你的任務就是寫一個程式,該程式要計算最少需要交換幾次兩個相鄰車廂,才能將所有車廂依序排好。

Input

The input contains the following lines:

輸入包含以下幾行:

The first line contains a positive integer �n representing the next number of Test cases.

第一行包含一個正整數�n代表接下來有多少個Test cases。

Next, there are �n groups of Test cases. Each group of Test cases contains a positive integer �(0≤�≤50)L(0≤L≤50) representing the length of the train and the sorted sequence of the current train cars.

接下來有�n 組 Test cases,每一組 Test case 包含一個正整數�(0≤�≤50)L(0≤L≤50)代表火車的長度,以及目前火車車廂的排序數列。

Output

For each group of test assets, please output:

對於每組測資,請輸出:

"Optimal train swapping takes S swaps.", S represents the minimum number of swaps.

"Optimal train swapping takes S swaps.",S代表最少交換次數。

Sample Input 1

Sample Input 2

3
3
1 3 2
4
4 3 2 1
2
2 1