Given two strings, and , your task is to construct a compressed suffix tree that includes all suffixes of both strings.
The goal is to create a tree with the minimum number of vertices.
The first line contains the string (1 \le |s| \le 10^4), ending with the character "$". All other characters are lowercase Latin letters. The second line contains the string (1 \le |t| \le 10^4), ending with the character "#". All other characters are lowercase Latin letters.
Number the vertices of the tree from to n-1 using a depth-first search, ordering subtrees based on the lexicographical order of the outgoing edges from each vertex. Use the ASCII values of characters to determine this order.
First, output an integer , which is the total number of vertices in the tree. Then, for the next n-1 lines, provide the description of each tree vertex, excluding the root, in ascending order of their numbers.
The description for a vertex includes four integers: , , , . Here, (0 \le p < n, p \ne v) is the parent vertex number, (0 \le w \le 1) indicates which string determines the substring on the edge. If w = 0, the edge from to contains the substring s[lf \ldots rg-1] (0 \le lf < rg \le |s|). If w = 1, the edge contains the substring t[lf \ldots rg-1] (0 \le lf < rg \le |t|).
Example 1