Python Hard
```python3 []
class Solution:
    def findTheString(self, lcp: List[List[int]]) -> str:
        '''
        N x N grid
        N ** 2 works

        lcp[i][j] is equal to the length of the longest common prefix between the substrings word[i,n-1] and word[j,n-1].

        can we do this:

        by definition, we build out the string only using lcp[0][0]?

        then z function it

        and make sure that it matches for all lcp

        if N == 4

        0, 0 has to be 4
        1, 1 has to be 3
        2, 2 has to be 2
        3, 3 has to be 1


        lcp[i][j] means the longest common prefix between word[i] and word[j]

        so lcp[i][j] == lcp[j][i]

        maybe topo sort

        we want lex smallest

        I think its greedy not dp

        how do we do this

        first char is always a

        then, if 
        '''
        def z_function(s):
            z, l, r, n = [0] * len(s), 0, 0, len(s)
            for i in range(1, n):
                if i < r:
                    z[i] = min(r - i, z[i - l])
                while i + z[i] < n and s[i + z[i]] == s[z[i]]:
                    z[i] += 1
                if i + z[i] > r:
                    l, r = i, i + z[i]

            return z

        N = len(lcp)
        for i in range(N):
            for j in range(N):
                if lcp[i][j] != lcp[j][i]:
                    return ""


        for i in range(N):
            if lcp[i][i] != N - i:
                return ""


        s = [0] * N
        

        for i in range(N):
            for j in range(i+1, N):
                if lcp[i][j] == 0 and s[i] == s[j]:
                    s[j] = s[i] + 1


        for index, x in enumerate(s):
            if x > 25:
                return ""
            s[index] = chr(ord('a') + x)

        s = "".join(s)

        for i in range(N):
            z = z_function(s[i:])
           
            if z[1:] != lcp[i][i+1:]:
                return ""
        

        
        return s


        
        
```
['Python3']