public void tryNext(ArrayList<String> res, char[] has, int pos, int n, int i, int j) {
        if(i == n && j == n) {
            StringBuilder sb = new StringBuilder();
            for(int t = 0; t < has.length; t++) sb.append(has[t]);
            res.add(sb.toString());
            return;
        } else {
            if(i < n) {
                has[pos] = '(';
                tryNext(res, has, pos+1, n, i+1, j);
            }
            if(i > j) {
                has[pos] = ')';
                tryNext(res, has, pos+1, n, i, j+1);
            }
        }
    }