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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: E = None
        self.q: D = None
        self.z: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: C = None
        self.q: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: E = None
        self.q: D = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: F = None
        self.s: E = None
        self.txt = txt

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

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

h.v = n
h.q = n
h.u = f
h.w = f
n.r = f
n.y = k
n.q = g
n.z = a
i.r = k
i.y = f
g.p = k
g.z = i
g.q = h
k.w = a
k.q = g
f.w = g
f.q = g
f.p = k
f.y = n
e.r = h
e.z = f
e.s = k
a.o = h
assert h.v.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: F = None
        self.q: B = None
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: E = None
        self.q: D = None
        self.z: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: C = None
        self.q: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: E = None
        self.q: D = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: F = None
        self.s: E = None
        self.txt = txt

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

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

h.v = n
h.q = n
h.u = f
h.w = f
n.r = f
n.y = k
n.q = g
n.z = a
i.r = k
i.y = f
g.p = k
g.z = i
g.q = h
k.w = a
k.q = g
f.w = g
f.q = g
f.p = k
f.y = n
e.r = h
e.z = f
e.s = k
a.o = h
assert h.v.z.o.txt == "h"