public void solve() throws IOException {
    int tests = nextInt();
    for (int t = 0; t < tests; t++) {
      int n = nextInt();
      
      List<Interval> topint = getIntervals(nextLine());
      List<Interval> botint = getIntervals(nextLine());
      
      //System.out.format("Pre: %d %d%n", topint.size(), botint.size());

      int total = 0;
      
      for (int x = 0; x < topint.size(); x++) {
        Interval i = topint.get(x);
        if (i.start == i.end) {
          for (Interval j : botint) {
            if (contains(j, i.start)) {
              botint.remove(j);
              topint.remove(x--);
              total++;
              break;
            }
          }
        }
      }
      
      for (int x = 0; x < botint.size(); x++) {
        Interval i = botint.get(x);
        if (i.start == i.end) {
          for (Interval j : topint) {
            if (contains(j, i.start)) {
              topint.remove(j);
              botint.remove(x--);
              total++;
              break;
            }
          }
        }
      }
      
      //System.out.format("Post: %d %d%n", topint.size(), botint.size());
      
      total += topint.size();
      total += botint.size();
      
      System.out.format("Case #%d: %d%n", t + 1, total);
    }
  }