class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: B = None
        self.y: D = None
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

e = A("e")
b = B("b")
a = C("a")
i = D("i")
d = E("d")

e.r = i
e.y = i
e.o = i
e.p = i
e.w = b
b.s = e
b.x = e
b.v = e
b.t = a
b.w = d
a.z = d
i.v = a
i.r = d
d.q = a
assert a.z.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: B = None
        self.y: D = None
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

e = A("e")
b = B("b")
a = C("a")
i = D("i")
d = E("d")

e.r = i
e.y = i
e.o = i
e.p = i
e.w = b
b.s = e
b.x = e
b.v = e
b.t = a
b.w = d
a.z = d
i.v = a
i.r = d
d.q = a
assert a.z.q.z.q.txt == "a"