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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: D = None
        self.q: D = None
        self.s: D = None
        self.txt = txt

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

g = A("g")
m = B("m")
b = C("b")
c = D("c")
l = D("l")
a = A("a")
f = A("f")
d = B("d")
n = D("n")
e = C("e")

g.z = d
m.s = g
m.v = d
b.t = d
b.z = c
b.q = l
b.s = l
c.x = d
l.x = d
a.z = m
f.z = d
d.s = g
d.v = m
n.x = m
e.t = m
e.z = l
e.q = c
e.s = c
assert f.z.s.z.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: D = None
        self.q: D = None
        self.s: D = None
        self.txt = txt

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

g = A("g")
m = B("m")
b = C("b")
c = D("c")
l = D("l")
a = A("a")
f = A("f")
d = B("d")
n = D("n")
e = C("e")

g.z = d
m.s = g
m.v = d
b.t = d
b.z = c
b.q = l
b.s = l
c.x = d
l.x = d
a.z = m
f.z = d
d.s = g
d.v = m
n.x = m
e.t = m
e.z = l
e.q = c
e.s = c
assert f.z.s.z.s.z.txt == "d"