class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: F = None
        self.q: F = None
        self.p: C = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: E = None
        self.o: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

c = A("c")
g = B("g")
e = C("e")
l = D("l")
m = E("m")
n = F("n")
b = G("b")

c.z = l
c.r = n
c.q = n
c.p = e
c.v = g
g.v = b
e.w = l
e.u = m
e.s = m
e.o = g
l.u = c
l.r = m
l.p = n
m.z = e
m.x = n
n.t = c
n.q = g
b.x = l
assert m.z.u.x.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: F = None
        self.q: F = None
        self.p: C = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: E = None
        self.o: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

c = A("c")
g = B("g")
e = C("e")
l = D("l")
m = E("m")
n = F("n")
b = G("b")

c.z = l
c.r = n
c.q = n
c.p = e
c.v = g
g.v = b
e.w = l
e.u = m
e.s = m
e.o = g
l.u = c
l.r = m
l.p = n
m.z = e
m.x = n
n.t = c
n.q = g
b.x = l
assert m.z.u.x.q.v.txt == "b"