class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: G = None
        self.u: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: E = None
        self.r: D = None
        self.o: C = None
        self.t: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

a = A("a")
h = B("h")
i = C("i")
g = D("g")
k = E("k")
d = F("d")
b = G("b")
m = H("m")
c = D("c")

a.u = i
h.q = c
h.o = b
h.u = g
i.o = a
i.z = d
i.r = h
i.u = b
g.r = d
g.s = k
k.v = i
k.t = d
d.z = h
d.w = c
d.o = g
d.q = a
b.z = k
b.v = k
b.r = g
b.o = i
b.t = c
m.q = h
c.r = d
c.s = k
assert m.q.o.r.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: G = None
        self.u: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: E = None
        self.r: D = None
        self.o: C = None
        self.t: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

a = A("a")
h = B("h")
i = C("i")
g = D("g")
k = E("k")
d = F("d")
b = G("b")
m = H("m")
c = D("c")

a.u = i
h.q = c
h.o = b
h.u = g
i.o = a
i.z = d
i.r = h
i.u = b
g.r = d
g.s = k
k.v = i
k.t = d
d.z = h
d.w = c
d.o = g
d.q = a
b.z = k
b.v = k
b.r = g
b.o = i
b.t = c
m.q = h
c.r = d
c.s = k
assert m.q.o.r.r.q.txt == "a"