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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: E = None
        self.v: A = None
        self.t: A = None
        self.u: D = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: E = None
        self.v: A = None
        self.t: A = None
        self.u: D = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

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

h.q = n
c.w = n
c.u = n
c.s = e
c.v = h
c.t = h
c.o = b
f.q = c
f.o = c
f.p = g
n.z = e
k.p = c
k.w = c
b.z = d
b.o = c
g.x = e
g.z = f
g.q = d
g.s = n
g.w = n
d.t = h
d.w = c
l.q = n
e.p = c
e.w = c
assert k.p.o.z.t.q.z.p.v.txt == "h"