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

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

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

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

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

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

m = A("m")
h = B("h")
f = C("f")
e = D("e")
d = E("d")
i = F("i")
n = F("n")
b = B("b")
g = B("g")

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

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

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

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

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

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

m = A("m")
h = B("h")
f = C("f")
e = D("e")
d = E("d")
i = F("i")
n = F("n")
b = B("b")
g = B("g")

m.w = e
m.x = f
h.x = m
f.u = d
e.w = f
d.x = f
d.r = f
d.t = h
d.z = m
d.w = m
d.s = b
i.w = m
n.w = m
b.x = m
g.x = m
assert n.w.w.w.u.r.u.r.u.s.txt == "b"