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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: A = None
        self.u: A = None
        self.w: G = None
        self.o: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: A = None
        self.o: C = None
        self.r: F = None
        self.z: D = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: A = None
        self.u: A = None
        self.w: G = None
        self.o: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: A = None
        self.o: C = None
        self.r: F = None
        self.z: D = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: E = None
        self.txt = txt

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

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

b.q = g
b.x = g
b.z = n
b.p = f
f.r = a
f.v = b
f.u = b
f.o = b
f.w = c
n.r = a
j.s = c
j.q = c
j.p = f
m.x = a
m.r = a
m.w = b
m.u = b
m.o = n
m.z = j
a.v = m
a.p = g
c.x = j
c.o = m
g.v = b
g.w = f
g.z = n
g.y = n
g.q = n
g.u = j
assert b.z.r.p.v.z.r.p.z.txt == "n"