class A:
    def __init__(self, txt: str):
        self.o: H = None
        self.v: G = None
        self.r: H = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: H = None
        self.s: H = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: G = None
        self.r: D = None
        self.u: F = None
        self.w: B = None
        self.txt = txt

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

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

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

n = A("n")
k = B("k")
d = C("d")
l = D("l")
i = E("i")
b = F("b")
g = G("g")
h = H("h")
e = A("e")

n.o = h
n.r = h
n.v = g
n.q = i
k.p = b
k.q = h
k.s = h
k.z = i
d.x = b
l.r = d
l.w = g
l.q = i
i.s = k
i.w = k
i.t = g
i.r = l
i.u = b
b.r = g
b.o = g
b.x = l
g.t = n
g.x = d
g.p = d
h.x = k
h.y = k
h.z = b
h.o = b
h.v = g
h.p = g
e.o = h
e.r = h
e.v = g
e.q = i
assert k.q.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: H = None
        self.v: G = None
        self.r: H = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: H = None
        self.s: H = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: G = None
        self.r: D = None
        self.u: F = None
        self.w: B = None
        self.txt = txt

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

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

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

n = A("n")
k = B("k")
d = C("d")
l = D("l")
i = E("i")
b = F("b")
g = G("g")
h = H("h")
e = A("e")

n.o = h
n.r = h
n.v = g
n.q = i
k.p = b
k.q = h
k.s = h
k.z = i
d.x = b
l.r = d
l.w = g
l.q = i
i.s = k
i.w = k
i.t = g
i.r = l
i.u = b
b.r = g
b.o = g
b.x = l
g.t = n
g.x = d
g.p = d
h.x = k
h.y = k
h.z = b
h.o = b
h.v = g
h.p = g
e.o = h
e.r = h
e.v = g
e.q = i
assert k.q.x.z.txt == "i"