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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: F = None
        self.z: E = None
        self.q: C = None
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: F = None
        self.o: A = None
        self.x: A = None
        self.txt = txt

g = A("g")
b = B("b")
l = C("l")
e = D("e")
c = E("c")
n = F("n")
m = G("m")
a = H("a")

g.w = l
b.o = g
l.r = b
l.w = n
e.r = l
e.q = l
e.o = l
e.w = n
e.z = c
c.z = b
c.o = b
c.s = b
n.p = a
m.w = l
a.s = e
a.t = n
a.o = g
a.x = g
assert b.o.w.w.p.s.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: F = None
        self.z: E = None
        self.q: C = None
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: F = None
        self.o: A = None
        self.x: A = None
        self.txt = txt

g = A("g")
b = B("b")
l = C("l")
e = D("e")
c = E("c")
n = F("n")
m = G("m")
a = H("a")

g.w = l
b.o = g
l.r = b
l.w = n
e.r = l
e.q = l
e.o = l
e.w = n
e.z = c
c.z = b
c.o = b
c.s = b
n.p = a
m.w = l
a.s = e
a.t = n
a.o = g
a.x = g
assert b.o.w.w.p.s.w.p.txt == "a"