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

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: E = None
        self.p: G = None
        self.z: E = None
        self.v: C = None
        self.x: F = None
        self.o: C = None
        self.txt = txt

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

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

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

b = A("b")
n = B("n")
d = C("d")
m = D("m")
j = E("j")
e = F("e")
a = G("a")

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: E = None
        self.p: G = None
        self.z: E = None
        self.v: C = None
        self.x: F = None
        self.o: C = None
        self.txt = txt

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

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

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

b = A("b")
n = B("n")
d = C("d")
m = D("m")
j = E("j")
e = F("e")
a = G("a")

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