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

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

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

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

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

b = A("b")
m = B("m")
g = C("g")
e = D("e")
n = E("n")
j = C("j")
h = B("h")

b.w = n
b.x = e
b.u = e
m.q = b
m.y = h
m.s = e
g.v = n
g.w = j
g.t = h
e.s = b
n.t = e
n.p = g
n.z = g
j.v = n
j.w = g
j.t = m
h.q = b
h.y = m
h.s = e
assert j.v.t.s.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
g = C("g")
e = D("e")
n = E("n")
j = C("j")
h = B("h")

b.w = n
b.x = e
b.u = e
m.q = b
m.y = h
m.s = e
g.v = n
g.w = j
g.t = h
e.s = b
n.t = e
n.p = g
n.z = g
j.v = n
j.w = g
j.t = m
h.q = b
h.y = m
h.s = e
assert j.v.t.s.w.z.w.txt == "j"