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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: E = None
        self.p: A = None
        self.r: E = None
        self.x: B = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: G = None
        self.v: G = None
        self.p: E = None
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: C = None
        self.p: C = None
        self.v: E = None
        self.o: C = None
        self.x: B = None
        self.txt = txt

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

n.v = k
n.q = g
n.o = h
n.t = m
h.w = k
h.y = k
h.p = d
g.s = f
g.u = h
d.s = g
d.t = g
d.v = m
d.r = m
d.p = n
d.x = h
m.q = k
m.r = f
m.v = n
k.w = f
k.z = f
k.v = f
k.p = m
k.r = d
f.s = k
f.r = g
f.p = g
f.o = g
f.v = m
f.x = h
assert h.w.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: C = None
        self.o: B = None
        self.t: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: E = None
        self.p: A = None
        self.r: E = None
        self.x: B = None
        self.t: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: G = None
        self.v: G = None
        self.p: E = None
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: C = None
        self.p: C = None
        self.v: E = None
        self.o: C = None
        self.x: B = None
        self.txt = txt

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

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