class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: D = None
        self.y: H = None
        self.p: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: C = None
        self.v: E = None
        self.q: F = None
        self.s: G = None
        self.p: A = None
        self.txt = txt

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

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

c.q = m
c.r = n
c.y = h
c.p = d
j.t = c
m.u = b
m.o = n
n.q = m
l.r = j
l.p = b
l.w = c
b.z = l
g.u = n
g.z = m
g.v = l
g.q = b
g.s = d
g.p = c
a.u = h
a.z = b
d.u = n
d.z = m
d.v = l
d.q = b
d.s = g
d.p = c
h.u = a
h.z = b
assert b.z.r.t.r.q.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: D = None
        self.y: H = None
        self.p: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: C = None
        self.v: E = None
        self.q: F = None
        self.s: G = None
        self.p: A = None
        self.txt = txt

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

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

c.q = m
c.r = n
c.y = h
c.p = d
j.t = c
m.u = b
m.o = n
n.q = m
l.r = j
l.p = b
l.w = c
b.z = l
g.u = n
g.z = m
g.v = l
g.q = b
g.s = d
g.p = c
a.u = h
a.z = b
d.u = n
d.z = m
d.v = l
d.q = b
d.s = g
d.p = c
h.u = a
h.z = b
assert b.z.r.t.r.q.o.q.txt == "m"