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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: B = None
        self.q: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: H = None
        self.z: E = None
        self.r: F = None
        self.q: H = None
        self.txt = txt

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

c = A("c")
m = B("m")
h = C("h")
g = D("g")
d = E("d")
b = F("b")
f = G("f")
n = H("n")

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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: B = None
        self.q: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: H = None
        self.z: E = None
        self.r: F = None
        self.q: H = None
        self.txt = txt

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

c = A("c")
m = B("m")
h = C("h")
g = D("g")
d = E("d")
b = F("b")
f = G("f")
n = H("n")

c.w = f
c.s = h
m.t = c
m.r = n
m.u = h
h.z = b
g.r = f
g.q = f
g.x = m
d.o = m
d.w = n
b.u = h
f.o = c
f.s = n
f.q = n
f.z = d
f.r = b
n.z = g
n.x = b
assert c.s.z.u.z.txt == "b"