class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: C = None
        self.z: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

k = A("k")
c = B("c")
j = C("j")
a = D("a")
i = E("i")

k.q = i
k.v = j
k.x = j
k.z = a
c.p = j
j.y = a
j.x = a
a.r = j
a.z = i
a.p = k
i.p = j
i.t = a
i.r = k
assert c.p.y.p.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.v: C = None
        self.z: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

k = A("k")
c = B("c")
j = C("j")
a = D("a")
i = E("i")

k.q = i
k.v = j
k.x = j
k.z = a
c.p = j
j.y = a
j.x = a
a.r = j
a.z = i
a.p = k
i.p = j
i.t = a
i.r = k
assert c.p.y.p.v.x.txt == "a"