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

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: D = None
        self.y: G = None
        self.t: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: B = None
        self.p: C = None
        self.t: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: C = None
        self.w: F = None
        self.r: G = None
        self.y: C = None
        self.v: A = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

a = A("a")
b = B("b")
d = C("d")
e = D("e")
n = E("n")
m = F("m")
f = G("f")
h = H("h")
i = D("i")

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

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: D = None
        self.y: G = None
        self.t: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: B = None
        self.p: C = None
        self.t: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: C = None
        self.w: F = None
        self.r: G = None
        self.y: C = None
        self.v: A = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

a = A("a")
b = B("b")
d = C("d")
e = D("e")
n = E("n")
m = F("m")
f = G("f")
h = H("h")
i = D("i")

a.r = b
b.o = e
b.v = n
b.w = a
d.x = m
d.v = e
d.y = f
d.t = a
e.t = n
e.u = n
e.y = a
e.p = m
e.s = b
e.r = f
n.r = e
n.v = d
n.q = d
n.w = h
n.u = f
n.z = a
m.q = a
f.y = d
f.p = d
f.q = b
f.t = h
h.o = m
h.w = m
h.z = d
h.y = d
h.s = d
h.r = f
h.v = a
h.t = n
i.t = n
i.u = n
i.y = a
i.p = m
i.s = b
i.r = f
assert h.r.t.w.q.r.w.txt == "a"