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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: A = None
        self.q: A = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: C = None
        self.txt = txt

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

b = A("b")
d = B("d")
m = C("m")
h = D("h")
g = E("g")
f = F("f")
i = G("i")
e = H("e")
k = F("k")
j = H("j")

b.o = m
b.z = k
b.w = e
b.x = e
b.y = h
b.q = h
b.r = d
b.p = i
d.o = b
d.p = j
m.p = g
h.q = m
h.z = k
h.s = f
h.v = b
h.o = b
h.w = j
h.u = e
g.s = m
g.r = b
g.q = b
g.p = b
f.r = b
i.v = h
i.p = m
e.q = j
e.t = j
e.r = d
k.r = b
j.q = e
j.t = e
j.r = d
assert d.o.o.p.r.o.p.q.q.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: F = None
        self.w: H = None
        self.y: D = None
        self.q: D = None
        self.x: H = None
        self.r: B = None
        self.p: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: A = None
        self.q: A = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: C = None
        self.txt = txt

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

b = A("b")
d = B("d")
m = C("m")
h = D("h")
g = E("g")
f = F("f")
i = G("i")
e = H("e")
k = F("k")
j = H("j")

b.o = m
b.z = k
b.w = e
b.x = e
b.y = h
b.q = h
b.r = d
b.p = i
d.o = b
d.p = j
m.p = g
h.q = m
h.z = k
h.s = f
h.v = b
h.o = b
h.w = j
h.u = e
g.s = m
g.r = b
g.q = b
g.p = b
f.r = b
i.v = h
i.p = m
e.q = j
e.t = j
e.r = d
k.r = b
j.q = e
j.t = e
j.r = d
assert d.o.o.p.r.o.p.q.q.q.p.txt == "g"