class A:
    def __init__(self, txt: str):
        self.x: G = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: G = None
        self.u: E = None
        self.w: D = None
        self.s: A = None
        self.x: E = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: C = None
        self.x: H = None
        self.o: F = None
        self.w: D = None
        self.txt = txt

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

a = A("a")
j = B("j")
c = C("c")
k = D("k")
m = E("m")
d = F("d")
l = G("l")
f = H("f")
g = C("g")

a.x = l
a.t = j
j.p = g
j.q = l
j.u = m
j.x = m
j.w = k
j.s = a
c.y = l
k.q = f
k.p = a
k.y = l
m.v = l
d.u = l
d.o = f
d.t = c
d.r = m
d.z = k
l.r = g
l.u = g
l.x = f
l.o = d
l.w = k
f.u = a
f.x = k
f.o = j
g.y = l
assert k.q.x.p.x.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: G = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: G = None
        self.u: E = None
        self.w: D = None
        self.s: A = None
        self.x: E = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: C = None
        self.x: H = None
        self.o: F = None
        self.w: D = None
        self.txt = txt

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

a = A("a")
j = B("j")
c = C("c")
k = D("k")
m = E("m")
d = F("d")
l = G("l")
f = H("f")
g = C("g")

a.x = l
a.t = j
j.p = g
j.q = l
j.u = m
j.x = m
j.w = k
j.s = a
c.y = l
k.q = f
k.p = a
k.y = l
m.v = l
d.u = l
d.o = f
d.t = c
d.r = m
d.z = k
l.r = g
l.u = g
l.x = f
l.o = d
l.w = k
f.u = a
f.x = k
f.o = j
g.y = l
assert k.q.x.p.x.o.o.o.txt == "j"