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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: B = None
        self.x: B = None
        self.txt = txt

h = A("h")
e = B("e")
m = C("m")
j = C("j")
a = B("a")
c = C("c")
l = C("l")

h.o = e
h.w = j
e.o = m
e.z = a
m.z = a
m.x = a
m.o = e
j.z = e
j.o = a
j.x = a
a.o = j
a.z = e
c.z = a
c.o = a
c.x = e
l.z = a
l.x = a
l.o = e
assert a.o.x.o.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: B = None
        self.x: B = None
        self.txt = txt

h = A("h")
e = B("e")
m = C("m")
j = C("j")
a = B("a")
c = C("c")
l = C("l")

h.o = e
h.w = j
e.o = m
e.z = a
m.z = a
m.x = a
m.o = e
j.z = e
j.o = a
j.x = a
a.o = j
a.z = e
c.z = a
c.o = a
c.x = e
l.z = a
l.x = a
l.o = e
assert a.o.x.o.z.z.z.txt == "e"