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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: B = None
        self.v: D = None
        self.t: C = None
        self.txt = txt

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

d.r = b
d.s = f
c.u = b
c.o = b
f.z = b
m.p = c
m.r = c
m.v = n
m.t = f
e.p = c
e.r = c
e.v = n
e.t = b
b.z = f
n.p = c
n.r = c
n.v = m
n.t = b
assert e.r.u.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: B = None
        self.v: D = None
        self.t: C = None
        self.txt = txt

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

d.r = b
d.s = f
c.u = b
c.o = b
f.z = b
m.p = c
m.r = c
m.v = n
m.t = f
e.p = c
e.r = c
e.v = n
e.t = b
b.z = f
n.p = c
n.r = c
n.v = m
n.t = b
assert e.r.u.z.z.z.txt == "f"