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

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

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

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

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

i = A("i")
j = B("j")
m = C("m")
h = D("h")
c = E("c")
n = A("n")

i.u = c
i.z = h
j.t = n
m.t = c
h.w = i
c.z = h
c.x = h
n.u = c
n.z = h
assert j.t.z.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
m = C("m")
h = D("h")
c = E("c")
n = A("n")

i.u = c
i.z = h
j.t = n
m.t = c
h.w = i
c.z = h
c.x = h
n.u = c
n.z = h
assert j.t.z.w.u.txt == "c"