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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: A = None
        self.x: D = None
        self.y: A = None
        self.txt = txt

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

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

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

c = A("c")
m = B("m")
l = C("l")
a = D("a")
e = E("e")

c.y = m
m.p = l
m.v = c
m.y = c
m.x = a
l.s = a
l.z = a
a.q = l
e.q = m
assert e.q.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: A = None
        self.x: D = None
        self.y: A = None
        self.txt = txt

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

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

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

c = A("c")
m = B("m")
l = C("l")
a = D("a")
e = E("e")

c.y = m
m.p = l
m.v = c
m.y = c
m.x = a
l.s = a
l.z = a
a.q = l
e.q = m
assert e.q.p.z.txt == "a"