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

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

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

l = A("l")
f = B("f")
d = C("d")
h = C("h")
m = C("m")

l.w = f
l.u = m
l.z = d
f.p = l
f.x = l
f.o = h
d.w = m
d.s = l
d.y = l
h.w = d
h.s = l
h.y = l
m.w = d
m.s = l
m.y = l
assert d.y.u.w.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
d = C("d")
h = C("h")
m = C("m")

l.w = f
l.u = m
l.z = d
f.p = l
f.x = l
f.o = h
d.w = m
d.s = l
d.y = l
h.w = d
h.s = l
h.y = l
m.w = d
m.s = l
m.y = l
assert d.y.u.w.s.z.txt == "d"