// Danny Wasserman
// 7/23/2014
// Solution to 2014 SI@UCF Contest Problem: The Simplex Algorithm

import java.util.Scanner;
import java.util.StringTokenizer;

public class simplex {
  public static void main(String[] args) {

    Scanner in = new Scanner(System.in);
    int cases = in.nextInt();
    in.nextLine();

    // Go through each case.
    for (int co = 1; co <= cases; co++) {

      // Read and tokenize the equation.
      String line = in.nextLine();
      StringTokenizer st = new StringTokenizer(line, " +");
      boolean noSol = true;

      // Go through each token.
      while (st.hasMoreTokens()) {
        String token = st.nextToken();

        // This one has an x, the rest is the coefficient.
        if (token.contains("x")) {
          System.out.printf("%s\n", token.substring(0, token.length() - 1));
          noSol = false;
        }
      }

      // No x :(
      if (noSol) System.out.printf("x not found\n");
    }
  }
}
