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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: H = None
        self.s: D = None
        self.t: G = None
        self.z: H = None
        self.q: G = None
        self.w: F = None
        self.u: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: F = None
        self.u: E = None
        self.s: D = None
        self.q: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.u: A = None
        self.y: B = None
        self.v: E = None
        self.q: C = None
        self.p: G = None
        self.txt = txt

m = A("m")
n = B("n")
f = C("f")
i = D("i")
g = E("g")
j = F("j")
l = G("l")
d = H("d")

m.o = f
n.p = i
n.s = i
n.o = d
n.z = d
n.u = d
n.t = l
n.q = l
n.w = j
f.y = n
f.u = m
i.u = d
g.p = n
j.r = n
l.w = m
l.y = j
l.q = j
l.u = g
l.s = i
d.t = f
d.w = f
d.q = f
d.u = m
d.y = n
d.v = g
d.p = l
assert f.y.p.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: H = None
        self.s: D = None
        self.t: G = None
        self.z: H = None
        self.q: G = None
        self.w: F = None
        self.u: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: F = None
        self.u: E = None
        self.s: D = None
        self.q: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.u: A = None
        self.y: B = None
        self.v: E = None
        self.q: C = None
        self.p: G = None
        self.txt = txt

m = A("m")
n = B("n")
f = C("f")
i = D("i")
g = E("g")
j = F("j")
l = G("l")
d = H("d")

m.o = f
n.p = i
n.s = i
n.o = d
n.z = d
n.u = d
n.t = l
n.q = l
n.w = j
f.y = n
f.u = m
i.u = d
g.p = n
j.r = n
l.w = m
l.y = j
l.q = j
l.u = g
l.s = i
d.t = f
d.w = f
d.q = f
d.u = m
d.y = n
d.v = g
d.p = l
assert f.y.p.u.v.txt == "g"