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

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

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

f = A("f")
i = B("i")
d = C("d")
g = C("g")
a = B("a")
m = B("m")
e = C("e")
k = A("k")

f.w = i
f.y = k
f.z = k
i.r = m
d.t = a
d.u = f
d.q = e
g.t = a
g.u = k
g.q = e
a.r = i
m.r = i
e.t = m
e.u = k
e.q = d
k.w = a
k.y = f
k.z = f
assert e.q.u.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: A = None
        self.z: A = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
d = C("d")
g = C("g")
a = B("a")
m = B("m")
e = C("e")
k = A("k")

f.w = i
f.y = k
f.z = k
i.r = m
d.t = a
d.u = f
d.q = e
g.t = a
g.u = k
g.q = e
a.r = i
m.r = i
e.t = m
e.u = k
e.q = d
k.w = a
k.y = f
k.z = f
assert e.q.u.y.z.txt == "f"