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

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

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

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

a = A("a")
d = B("d")
l = C("l")
i = D("i")
e = D("e")

a.t = e
a.w = l
a.r = i
a.x = d
d.w = a
d.v = l
l.w = i
i.v = a
i.p = a
i.y = l
e.v = a
e.p = a
e.y = l
assert a.r.y.w.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: C = None
        self.r: D = None
        self.x: B = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
l = C("l")
i = D("i")
e = D("e")

a.t = e
a.w = l
a.r = i
a.x = d
d.w = a
d.v = l
l.w = i
i.v = a
i.p = a
i.y = l
e.v = a
e.p = a
e.y = l
assert a.r.y.w.y.w.txt == "i"