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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: A = None
        self.x: F = None
        self.q: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.r: D = None
        self.p: E = None
        self.w: D = None
        self.txt = txt

b = A("b")
g = B("g")
d = C("d")
f = D("f")
j = E("j")
k = F("k")
m = G("m")
c = C("c")
h = B("h")
l = F("l")

b.x = g
b.q = l
b.r = d
b.t = k
b.o = f
b.u = m
b.w = c
g.v = c
d.u = c
d.q = f
d.p = j
d.r = m
f.w = j
f.z = b
f.x = l
f.q = m
j.z = c
k.p = c
k.u = d
m.z = h
m.o = d
m.r = f
m.w = f
m.p = j
c.u = d
c.q = f
c.p = j
c.r = m
h.v = d
l.p = d
l.u = c
assert f.w.z.r.p.z.u.r.z.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: F = None
        self.r: C = None
        self.t: F = None
        self.o: D = None
        self.u: G = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: A = None
        self.x: F = None
        self.q: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.r: D = None
        self.p: E = None
        self.w: D = None
        self.txt = txt

b = A("b")
g = B("g")
d = C("d")
f = D("f")
j = E("j")
k = F("k")
m = G("m")
c = C("c")
h = B("h")
l = F("l")

b.x = g
b.q = l
b.r = d
b.t = k
b.o = f
b.u = m
b.w = c
g.v = c
d.u = c
d.q = f
d.p = j
d.r = m
f.w = j
f.z = b
f.x = l
f.q = m
j.z = c
k.p = c
k.u = d
m.z = h
m.o = d
m.r = f
m.w = f
m.p = j
c.u = d
c.q = f
c.p = j
c.r = m
h.v = d
l.p = d
l.u = c
assert f.w.z.r.p.z.u.r.z.v.r.txt == "m"