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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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