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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

d.z = c
f.v = c
f.p = c
a.x = d
b.p = f
c.t = f
c.s = m
m.z = c
e.x = m
assert a.x.z.s.z.txt == "c"