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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: G = None
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.q: C = None
        self.o: B = None
        self.p: D = None
        self.txt = txt

c = A("c")
b = B("b")
h = C("h")
m = D("m")
g = E("g")
j = F("j")
l = G("l")

c.w = h
b.w = g
b.s = g
b.u = h
b.x = h
h.w = b
h.s = j
m.s = h
m.u = l
m.z = b
g.u = j
g.x = j
g.o = h
j.y = m
j.z = g
j.p = l
l.z = j
l.q = h
l.o = b
l.p = m
assert m.s.s.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: G = None
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.q: C = None
        self.o: B = None
        self.p: D = None
        self.txt = txt

c = A("c")
b = B("b")
h = C("h")
m = D("m")
g = E("g")
j = F("j")
l = G("l")

c.w = h
b.w = g
b.s = g
b.u = h
b.x = h
h.w = b
h.s = j
m.s = h
m.u = l
m.z = b
g.u = j
g.x = j
g.o = h
j.y = m
j.z = g
j.p = l
l.z = j
l.q = h
l.o = b
l.p = m
assert m.s.s.z.o.txt == "h"