class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: B = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: E = None
        self.u: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: D = None
        self.r: C = None
        self.u: A = None
        self.p: F = None
        self.x: B = None
        self.txt = txt

a = A("a")
m = B("m")
l = C("l")
b = D("b")
i = E("i")
g = F("g")
f = G("f")
n = E("n")

a.w = g
a.s = m
a.x = b
m.p = l
l.r = f
l.s = g
b.y = a
b.z = n
b.u = l
i.s = l
i.t = n
i.w = a
i.p = a
i.y = f
i.r = f
g.t = b
g.u = b
g.x = a
f.t = m
f.x = m
f.y = b
f.r = l
f.u = a
f.p = g
n.s = l
n.t = i
n.w = a
n.p = a
n.y = f
n.r = f
assert n.t.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: B = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: E = None
        self.u: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: D = None
        self.r: C = None
        self.u: A = None
        self.p: F = None
        self.x: B = None
        self.txt = txt

a = A("a")
m = B("m")
l = C("l")
b = D("b")
i = E("i")
g = F("g")
f = G("f")
n = E("n")

a.w = g
a.s = m
a.x = b
m.p = l
l.r = f
l.s = g
b.y = a
b.z = n
b.u = l
i.s = l
i.t = n
i.w = a
i.p = a
i.y = f
i.r = f
g.t = b
g.u = b
g.x = a
f.t = m
f.x = m
f.y = b
f.r = l
f.u = a
f.p = g
n.s = l
n.t = i
n.w = a
n.p = a
n.y = f
n.r = f
assert n.t.r.p.txt == "g"