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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: A = None
        self.q: A = None
        self.r: C = None
        self.txt = txt

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

j.w = h
h.x = b
h.y = j
a.t = b
a.w = b
a.z = j
i.u = h
i.t = a
b.z = c
b.u = j
b.q = j
b.r = a
c.u = h
c.t = a
assert i.t.w.z.u.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: A = None
        self.q: A = None
        self.r: C = None
        self.txt = txt

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

j.w = h
h.x = b
h.y = j
a.t = b
a.w = b
a.z = j
i.u = h
i.t = a
b.z = c
b.u = j
b.q = j
b.r = a
c.u = h
c.t = a
assert i.t.w.z.u.y.w.txt == "h"