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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.o: C = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.o: C = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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