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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: D = None
        self.x: E = None
        self.v: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: D = None
        self.x: E = None
        self.v: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

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

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