class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.x: B = None
        self.z: F = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: C = None
        self.t: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.x: A = None
        self.s: A = None
        self.p: G = None
        self.q: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.w: D = None
        self.y: C = None
        self.q: B = None
        self.x: C = None
        self.o: A = None
        self.t: G = None
        self.txt = txt

b = A("b")
n = B("n")
k = C("k")
a = D("a")
d = E("d")
m = F("m")
i = G("i")
c = H("c")

b.q = c
b.x = n
b.z = m
b.r = k
n.q = i
n.o = b
k.t = m
k.o = m
k.z = m
k.q = b
k.u = d
k.y = d
k.x = i
k.p = c
a.q = b
d.x = i
d.p = k
d.t = k
m.o = b
m.x = b
m.s = b
m.r = a
m.q = a
m.p = i
i.x = k
i.y = m
c.v = b
c.o = b
c.z = n
c.q = n
c.w = a
c.y = k
c.x = k
c.t = i
assert b.x.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.x: B = None
        self.z: F = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: C = None
        self.t: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: D = None
        self.x: A = None
        self.s: A = None
        self.p: G = None
        self.q: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.w: D = None
        self.y: C = None
        self.q: B = None
        self.x: C = None
        self.o: A = None
        self.t: G = None
        self.txt = txt

b = A("b")
n = B("n")
k = C("k")
a = D("a")
d = E("d")
m = F("m")
i = G("i")
c = H("c")

b.q = c
b.x = n
b.z = m
b.r = k
n.q = i
n.o = b
k.t = m
k.o = m
k.z = m
k.q = b
k.u = d
k.y = d
k.x = i
k.p = c
a.q = b
d.x = i
d.p = k
d.t = k
m.o = b
m.x = b
m.s = b
m.r = a
m.q = a
m.p = i
i.x = k
i.y = m
c.v = b
c.o = b
c.z = n
c.q = n
c.w = a
c.y = k
c.x = k
c.t = i
assert b.x.o.q.txt == "c"