class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.txt = txt

d = A("d")
g = B("g")
f = B("f")
e = B("e")
n = B("n")
a = B("a")
k = A("k")
i = B("i")

d.s = k
g.u = d
g.t = f
f.u = d
f.t = i
e.u = k
e.t = a
n.u = d
n.t = e
a.u = d
a.t = i
k.s = d
i.u = k
i.t = n
assert k.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.txt = txt

d = A("d")
g = B("g")
f = B("f")
e = B("e")
n = B("n")
a = B("a")
k = A("k")
i = B("i")

d.s = k
g.u = d
g.t = f
f.u = d
f.t = i
e.u = k
e.t = a
n.u = d
n.t = e
a.u = d
a.t = i
k.s = d
i.u = k
i.t = n
assert k.s.s.s.s.s.s.txt == "k"