public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		while ((line = in.readLine()) != null && line.length() != 0) {
			int nCase = Integer.parseInt(line.trim());
			for (int i = 0; i < nCase; i++) {
				int[] a = readInts(in.readLine());
				int ans = 0;
				for (int j = 2; j < a.length; j++)
					if (a[j - 1] < a[j])
						ans++;
				out.append((i + 1) + " " + ans + "\n");
			}
		}
		System.out.print(out);
	}