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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: A = None
        self.p: A = None
        self.y: D = None
        self.s: F = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.t: D = None
        self.y: D = None
        self.s: H = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: B = None
        self.p: G = None
        self.x: D = None
        self.t: E = None
        self.v: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: A = None
        self.p: A = None
        self.y: D = None
        self.s: F = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: C = None
        self.t: D = None
        self.y: D = None
        self.s: H = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: B = None
        self.p: G = None
        self.x: D = None
        self.t: E = None
        self.v: A = None
        self.txt = txt

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

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

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

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