class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: D = None
        self.r: D = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: C = None
        self.v: B = None
        self.t: D = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: E = None
        self.o: G = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: D = None
        self.r: D = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: C = None
        self.v: B = None
        self.t: D = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: E = None
        self.o: G = None
        self.txt = txt

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

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

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