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

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

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

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

g = A("g")
e = B("e")
d = C("d")
n = D("n")
m = A("m")
f = C("f")

g.t = e
g.s = e
g.q = m
e.z = d
e.t = d
e.w = d
e.v = g
d.o = m
d.u = m
d.r = e
d.z = n
n.z = d
n.w = e
m.t = e
m.s = e
m.q = g
f.o = g
f.r = e
f.u = m
f.z = n
assert d.z.z.u.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.q: A = None
        self.txt = txt

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

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

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

g = A("g")
e = B("e")
d = C("d")
n = D("n")
m = A("m")
f = C("f")

g.t = e
g.s = e
g.q = m
e.z = d
e.t = d
e.w = d
e.v = g
d.o = m
d.u = m
d.r = e
d.z = n
n.z = d
n.w = e
m.t = e
m.s = e
m.q = g
f.o = g
f.r = e
f.u = m
f.z = n
assert d.z.z.u.t.z.txt == "d"