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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: G = None
        self.s: G = None
        self.x: B = None
        self.z: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: H = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: H = None
        self.z: H = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: G = None
        self.s: G = None
        self.x: B = None
        self.z: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: H = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: H = None
        self.z: H = None
        self.p: A = None
        self.txt = txt

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

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

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

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