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

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

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

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

c = A("c")
d = B("d")
e = C("e")
l = D("l")

c.t = e
c.s = d
d.y = e
e.v = c
l.s = c
assert d.y.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: B = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
e = C("e")
l = D("l")

c.t = e
c.s = d
d.y = e
e.v = c
l.s = c
assert d.y.v.t.txt == "e"