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

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

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

e = A("e")
g = B("g")
a = C("a")
l = C("l")
k = C("k")
d = A("d")
j = B("j")
f = A("f")

e.w = j
e.u = d
e.z = g
g.y = a
g.p = k
a.s = k
l.s = k
k.s = l
d.w = g
d.z = g
d.u = f
j.y = a
j.p = l
f.w = j
f.z = j
f.u = d
assert d.u.z.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.z: B = None
        self.txt = txt

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

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

e = A("e")
g = B("g")
a = C("a")
l = C("l")
k = C("k")
d = A("d")
j = B("j")
f = A("f")

e.w = j
e.u = d
e.z = g
g.y = a
g.p = k
a.s = k
l.s = k
k.s = l
d.w = g
d.z = g
d.u = f
j.y = a
j.p = l
f.w = j
f.z = j
f.u = d
assert d.u.z.y.s.txt == "k"