class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: B = None
        self.o: B = None
        self.x: F = None
        self.p: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: B = None
        self.z: A = None
        self.x: G = None
        self.q: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: A = None
        self.q: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: B = None
        self.z: A = None
        self.x: G = None
        self.q: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: A = None
        self.q: D = None
        self.w: D = None
        self.txt = txt

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

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