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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: A = None
        self.w: B = None
        self.t: C = None
        self.x: C = None
        self.txt = txt

b = A("b")
i = B("i")
e = C("e")
f = D("f")
m = E("m")
c = F("c")
g = G("g")

b.x = e
b.p = c
b.u = m
b.q = i
b.s = g
i.p = m
e.o = g
e.x = g
e.u = f
e.t = c
f.r = c
f.p = g
f.z = g
f.u = b
f.v = e
f.y = m
m.o = b
c.w = e
c.q = i
c.z = g
c.t = g
g.q = e
g.t = e
g.x = e
g.v = b
g.w = i
assert m.o.s.w.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: F = None
        self.u: E = None
        self.q: B = None
        self.s: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: A = None
        self.w: B = None
        self.t: C = None
        self.x: C = None
        self.txt = txt

b = A("b")
i = B("i")
e = C("e")
f = D("f")
m = E("m")
c = F("c")
g = G("g")

b.x = e
b.p = c
b.u = m
b.q = i
b.s = g
i.p = m
e.o = g
e.x = g
e.u = f
e.t = c
f.r = c
f.p = g
f.z = g
f.u = b
f.v = e
f.y = m
m.o = b
c.w = e
c.q = i
c.z = g
c.t = g
g.q = e
g.t = e
g.x = e
g.v = b
g.w = i
assert m.o.s.w.p.o.txt == "b"