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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: F = None
        self.w: A = None
        self.s: G = None
        self.y: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: C = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: B = None
        self.txt = txt

m = A("m")
l = B("l")
a = C("a")
n = D("n")
g = E("g")
h = F("h")
f = G("f")

m.x = a
m.y = n
m.q = f
l.r = a
l.v = h
l.w = m
l.s = f
l.y = n
a.r = f
a.t = l
a.u = l
a.q = n
n.s = a
n.o = h
n.x = f
n.w = l
g.q = m
g.v = m
g.w = m
g.o = a
g.z = l
h.w = n
h.s = a
h.y = l
f.p = g
f.q = l
assert a.t.s.p.o.q.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: D = None
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: F = None
        self.w: A = None
        self.s: G = None
        self.y: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: C = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: B = None
        self.txt = txt

m = A("m")
l = B("l")
a = C("a")
n = D("n")
g = E("g")
h = F("h")
f = G("f")

m.x = a
m.y = n
m.q = f
l.r = a
l.v = h
l.w = m
l.s = f
l.y = n
a.r = f
a.t = l
a.u = l
a.q = n
n.s = a
n.o = h
n.x = f
n.w = l
g.q = m
g.v = m
g.w = m
g.o = a
g.z = l
h.w = n
h.s = a
h.y = l
f.p = g
f.q = l
assert a.t.s.p.o.q.s.q.txt == "n"