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

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.v: F = None
        self.z: B = None
        self.q: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: E = None
        self.p: F = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.o: G = None
        self.q: C = None
        self.p: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.v: F = None
        self.z: B = None
        self.q: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: E = None
        self.p: F = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.o: G = None
        self.q: C = None
        self.p: C = None
        self.txt = txt

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

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