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

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

h = A("h")
c = B("c")
l = B("l")
j = A("j")
g = A("g")
d = A("d")
e = A("e")
m = A("m")
n = B("n")
k = A("k")

h.o = n
c.z = j
c.u = e
l.z = j
l.u = h
j.o = c
g.o = l
d.o = c
e.o = c
m.o = n
n.z = k
n.u = h
k.o = c
assert n.u.o.z.o.u.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

h = A("h")
c = B("c")
l = B("l")
j = A("j")
g = A("g")
d = A("d")
e = A("e")
m = A("m")
n = B("n")
k = A("k")

h.o = n
c.z = j
c.u = e
l.z = j
l.u = h
j.o = c
g.o = l
d.o = c
e.o = c
m.o = n
n.z = k
n.u = h
k.o = c
assert n.u.o.z.o.u.o.u.o.txt == "c"