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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: D = None
        self.w: E = None
        self.txt = txt

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

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

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

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

e.y = h
e.s = h
c.v = h
c.w = h
c.z = f
j.w = h
f.x = e
h.u = j
assert f.x.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: D = None
        self.w: E = None
        self.txt = txt

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

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

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

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

e.y = h
e.s = h
c.v = h
c.w = h
c.z = f
j.w = h
f.x = e
h.u = j
assert f.x.y.u.txt == "j"