class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: A = None
        self.u: C = None
        self.r: F = None
        self.z: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: D = None
        self.o: C = None
        self.v: B = None
        self.p: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: A = None
        self.u: C = None
        self.r: F = None
        self.z: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: D = None
        self.o: C = None
        self.v: B = None
        self.p: E = None
        self.txt = txt

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

n.v = c
k.s = n
k.q = b
k.w = g
d.x = n
d.p = c
d.s = e
d.r = b
g.y = a
c.o = a
c.u = n
c.s = n
c.x = g
c.y = k
b.r = k
b.o = k
a.q = k
a.p = n
a.u = d
a.r = b
a.z = c
e.y = g
e.r = g
e.o = d
e.v = k
e.p = c
f.y = g
f.r = g
f.o = d
f.v = k
f.p = c
assert g.y.u.x.v.txt == "c"