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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: F = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: D = None
        self.u: H = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: F = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: D = None
        self.u: H = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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