class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

i.t = l
i.x = l
c.q = e
c.u = m
c.p = m
c.y = i
m.s = l
m.z = e
l.s = m
e.q = c
e.u = m
e.p = m
e.y = i
assert c.y.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

i.t = l
i.x = l
c.q = e
c.u = m
c.p = m
c.y = i
m.s = l
m.z = e
l.s = m
e.q = c
e.u = m
e.p = m
e.y = i
assert c.y.t.s.txt == "m"