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

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

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

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

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

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

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

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

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

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

i.z = e
i.s = b
i.t = d
e.q = d
e.s = b
e.x = b
d.t = e
d.z = e
b.z = i
b.q = e
b.v = e
assert e.q.t.s.v.txt == "e"