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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: E = None
        self.z: C = None
        self.r: H = None
        self.w: A = None
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: B = None
        self.o: B = None
        self.r: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: H = None
        self.z: D = None
        self.x: A = None
        self.u: D = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: H = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: E = None
        self.z: C = None
        self.r: H = None
        self.w: A = None
        self.s: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: B = None
        self.o: B = None
        self.r: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: H = None
        self.z: D = None
        self.x: A = None
        self.u: D = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: H = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: C = None
        self.txt = txt

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

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