#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)

typedef long long ll;
typedef unsigned long long ull;
typedef string st;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<st> vs;
typedef map<int,int> mii;
typedef map<st,int> msi;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define MOD 1e9+7

int mini;
int maxi;

int ans(vi nums, string ops, int size, int maxormin, bool start){
	int anss;
	int tempans;
	int ind = 0;

	if (maxormin == 1)
		anss = -2147483600;
	else		
		anss = 2147483600;

	if(size==2){
		char comp = ops[0];
		int base;
		if(comp=='+'){
			base= nums[0] + nums[1];
		}
		else if(comp=='-')
			base = nums[0]-nums[1];
		else
			base =  nums[0]*nums[1];
		//cout << "BASE:" << base <<endl;
		anss = base;
	}
	else{
		rep(i,size-1){
			vi temp(size-1);
			string tempops(size-2, ' ');
			char comp = ops[i];

			rep(k,i){
				temp[k] = nums[k];
				tempops[k] = ops[k];
			}

			if (comp == '+'){
				temp[i] = nums[i] + nums[i+1];
				//for(int j = 0; i<)

			}
			else if(comp=='*'){
				temp[i] = nums[i] * nums[i+1];
			}

			else if(comp=='-'){
				temp[i] = nums[i] - nums[i+1];
			}

			for(int j = i+1; j<size-1; j++){
				temp[j] = nums[j+1];
				if(j<size-1)
					tempops[j-1] = ops[j];
			}

			tempans = ans(temp, tempops, size-1,!maxormin, false);
			if(maxormin==1 && tempans>anss){
				//cout << "STRS:" << tempops;
				ind = i;
				anss = tempans;
			}

			if(maxormin==0 && tempans<anss){
				ind = i;
				anss = tempans;
			}		

		}
	}

	if(start){
		if (maxormin==1){
			maxi = ind;
		}
		else
			mini = ind;
	}
	
	return anss;

}

int main() {
	
	ios_base::sync_with_stdio(0);
	int n; cin >> n;
	int m,r1,r2;
	rep(i,n){
		cin >> m;
		m++;		//int temp;
		vi nums(m);
		string ops(m-1, ' ');

		rep(j,m){
			cin >> nums[j];
			if(j!=m-1)
				cin >> ops[j];
		}

		r1 = ans(nums, ops, m, 1, true);
		r2 = ans(nums,ops, m, 0, true);

		cout << "Case " << i+1 << ":" << endl;
		cout << "Player 1 (" << nums[maxi] <<ops[maxi] << nums[maxi+1] << ") leads to " << r1 << endl;
		cout << "Player 2 (" << nums[mini] <<ops[mini] << nums[mini+1] << ") leads to " << r2 << endl;

		if(r1>-r2)
			cout << "Player 1 wins" << endl;

		else if(r1<-r2)
			cout << "Player 2 wins" << endl;

		else
			cout << "Tie" << endl;

	}


	return 0;
}