class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: E = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: E = None
        self.q: C = None
        self.txt = txt

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

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