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

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

d = A("d")
h = B("h")
m = C("m")
l = A("l")
k = C("k")
g = B("g")
a = A("a")

d.o = g
h.x = a
h.u = g
h.w = m
m.w = k
m.u = k
m.z = k
l.o = h
k.w = m
k.u = m
k.z = m
g.x = a
g.u = h
g.w = k
a.o = g
assert l.o.x.o.u.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

d = A("d")
h = B("h")
m = C("m")
l = A("l")
k = C("k")
g = B("g")
a = A("a")

d.o = g
h.x = a
h.u = g
h.w = m
m.w = k
m.u = k
m.z = k
l.o = h
k.w = m
k.u = m
k.z = m
g.x = a
g.u = h
g.w = k
a.o = g
assert l.o.x.o.u.u.x.txt == "a"