class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: C = None
        self.w: C = None
        self.o: A = None
        self.v: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: B = None
        self.txt = txt

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

m = A("m")
d = B("d")
e = C("e")
n = D("n")
c = E("c")
g = A("g")
h = E("h")

m.s = n
m.z = e
m.w = e
m.o = g
m.v = g
d.z = e
d.w = c
d.y = c
d.x = n
e.w = c
e.y = c
e.s = m
e.t = d
e.x = g
n.r = h
n.s = d
c.u = n
c.w = n
g.s = n
g.z = e
g.w = e
g.o = m
g.v = m
h.u = n
h.w = n
assert h.w.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: C = None
        self.w: C = None
        self.o: A = None
        self.v: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: B = None
        self.txt = txt

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

m = A("m")
d = B("d")
e = C("e")
n = D("n")
c = E("c")
g = A("g")
h = E("h")

m.s = n
m.z = e
m.w = e
m.o = g
m.v = g
d.z = e
d.w = c
d.y = c
d.x = n
e.w = c
e.y = c
e.s = m
e.t = d
e.x = g
n.r = h
n.s = d
c.u = n
c.w = n
g.s = n
g.z = e
g.w = e
g.o = m
g.v = m
h.u = n
h.w = n
assert h.w.r.w.txt == "n"