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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: D = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: D = None
        self.w: H = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: H = None
        self.v: G = None
        self.q: H = None
        self.txt = txt

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

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

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

c.o = g
n.w = g
n.p = a
n.o = h
h.w = c
h.z = g
a.r = n
a.o = i
a.x = d
a.z = d
a.p = g
a.t = g
a.v = c
a.u = f
i.r = a
i.s = a
i.w = f
i.o = n
d.w = a
d.r = f
d.q = f
d.v = g
g.x = a
f.o = a
f.z = c
assert i.w.o.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.w: G = None
        self.p: D = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: D = None
        self.w: H = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: H = None
        self.v: G = None
        self.q: H = None
        self.txt = txt

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

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

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

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