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

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: F = None
        self.y: G = None
        self.w: B = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: F = None
        self.y: G = None
        self.w: B = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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