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

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

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

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

e = A("e")
i = B("i")
a = C("a")
n = D("n")

e.x = a
e.q = a
e.z = a
e.y = n
i.p = n
i.v = a
a.z = i
a.s = i
n.s = e
n.r = e
n.p = e
assert i.p.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: C = None
        self.z: C = None
        self.y: D = None
        self.txt = txt

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

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

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

e = A("e")
i = B("i")
a = C("a")
n = D("n")

e.x = a
e.q = a
e.z = a
e.y = n
i.p = n
i.v = a
a.z = i
a.s = i
n.s = e
n.r = e
n.p = e
assert i.p.r.q.txt == "a"