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

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

h = A("h")
m = B("m")
e = B("e")
i = B("i")
k = B("k")
a = A("a")
j = A("j")
n = A("n")
g = A("g")
l = A("l")

h.s = j
h.x = i
m.t = a
m.u = g
e.t = h
e.u = n
i.t = l
i.u = j
k.t = l
k.u = j
a.s = n
a.x = k
j.s = n
j.x = e
n.s = j
n.x = k
g.s = h
g.x = k
l.s = n
l.x = i
assert k.t.s.x.t.s.x.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: B = None
        self.txt = txt

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

h = A("h")
m = B("m")
e = B("e")
i = B("i")
k = B("k")
a = A("a")
j = A("j")
n = A("n")
g = A("g")
l = A("l")

h.s = j
h.x = i
m.t = a
m.u = g
e.t = h
e.u = n
i.t = l
i.u = j
k.t = l
k.u = j
a.s = n
a.x = k
j.s = n
j.x = e
n.s = j
n.x = k
g.s = h
g.x = k
l.s = n
l.x = i
assert k.t.s.x.t.s.x.t.x.txt == "i"