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

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

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

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

a = A("a")
c = B("c")
i = C("i")
l = D("l")
b = B("b")

a.v = l
c.x = i
c.y = l
i.x = l
i.y = a
l.y = b
l.t = i
l.s = i
b.x = i
b.y = l
assert i.x.y.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
i = C("i")
l = D("l")
b = B("b")

a.v = l
c.x = i
c.y = l
i.x = l
i.y = a
l.y = b
l.t = i
l.s = i
b.x = i
b.y = l
assert i.x.y.x.x.txt == "l"