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

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

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

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

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

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

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

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

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

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

e.x = c
m.w = e
m.y = i
i.v = m
i.o = c
c.t = l
c.s = i
l.t = c
l.s = i
assert c.s.v.y.v.y.txt == "i"