class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.w: E = None
        self.z: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.t: G = None
        self.s: E = None
        self.q: B = None
        self.y: H = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: C = None
        self.u: B = None
        self.v: G = None
        self.y: B = None
        self.z: C = None
        self.s: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.t: G = None
        self.s: E = None
        self.q: B = None
        self.y: H = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: C = None
        self.u: B = None
        self.v: G = None
        self.y: B = None
        self.z: C = None
        self.s: A = None
        self.x: C = None
        self.txt = txt

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

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