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

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

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

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

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

a = A("a")
j = B("j")
e = C("e")
h = D("h")
d = E("d")

a.o = e
a.w = e
j.y = d
e.y = j
e.u = a
h.r = e
d.v = j
d.u = j
d.p = e
d.o = e
assert d.v.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

a = A("a")
j = B("j")
e = C("e")
h = D("h")
d = E("d")

a.o = e
a.w = e
j.y = d
e.y = j
e.u = a
h.r = e
d.v = j
d.u = j
d.p = e
d.o = e
assert d.v.y.v.y.txt == "d"