class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: G = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.z: B = None
        self.x: D = None
        self.p: H = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: C = None
        self.z: C = None
        self.u: D = None
        self.o: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

f.s = k
f.x = n
f.o = h
d.z = n
d.r = f
e.s = a
e.p = a
e.z = d
e.x = k
k.x = f
h.t = e
h.x = n
h.s = k
b.p = k
b.z = n
n.w = e
n.x = e
n.z = e
n.u = k
n.o = k
a.y = b
assert b.p.x.o.t.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: G = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.z: B = None
        self.x: D = None
        self.p: H = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: C = None
        self.z: C = None
        self.u: D = None
        self.o: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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