class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.w: C = None
        self.v: D = None
        self.r: 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.r: B = None
        self.v: D = None
        self.u: B = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
h = C("h")
e = D("e")
b = E("b")

j.y = e
j.o = e
j.v = e
j.w = h
j.r = h
c.y = b
h.r = c
h.u = c
h.v = e
e.r = j
b.w = h
assert h.u.y.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.w: C = None
        self.v: D = None
        self.r: 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.r: B = None
        self.v: D = None
        self.u: B = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
h = C("h")
e = D("e")
b = E("b")

j.y = e
j.o = e
j.v = e
j.w = h
j.r = h
c.y = b
h.r = c
h.u = c
h.v = e
e.r = j
b.w = h
assert h.u.y.w.r.txt == "c"