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

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

a.s = h
a.r = c
a.y = i
d.t = g
d.s = k
m.p = h
m.y = a
n.y = a
n.r = i
c.z = g
c.w = g
c.o = m
c.p = h
h.z = c
k.x = h
k.y = n
i.y = c
i.r = a
i.p = a
i.w = e
i.o = d
i.t = d
i.z = n
i.x = h
g.p = h
g.y = a
e.y = a
e.r = i
assert h.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: E = None
        self.y: H = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

a.s = h
a.r = c
a.y = i
d.t = g
d.s = k
m.p = h
m.y = a
n.y = a
n.r = i
c.z = g
c.w = g
c.o = m
c.p = h
h.z = c
k.x = h
k.y = n
i.y = c
i.r = a
i.p = a
i.w = e
i.o = d
i.t = d
i.z = n
i.x = h
g.p = h
g.y = a
e.y = a
e.r = i
assert h.z.p.z.txt == "c"