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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

d = A("d")
l = B("l")
i = C("i")
j = D("j")
b = E("b")
e = A("e")

d.t = e
d.r = e
d.q = i
l.z = e
i.y = j
i.v = j
j.t = b
b.w = i
e.t = d
e.r = d
e.q = i
assert i.y.t.w.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: C = None
        self.r: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

d = A("d")
l = B("l")
i = C("i")
j = D("j")
b = E("b")
e = A("e")

d.t = e
d.r = e
d.q = i
l.z = e
i.y = j
i.v = j
j.t = b
b.w = i
e.t = d
e.r = d
e.q = i
assert i.y.t.w.y.t.txt == "b"