class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: G = None
        self.u: B = None
        self.t: D = None
        self.o: F = None
        self.y: B = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
j = C("j")
d = D("d")
f = E("f")
e = F("e")
h = G("h")
g = C("g")
k = G("k")

m.r = g
i.o = f
i.y = f
i.t = g
i.v = j
j.x = e
d.t = f
d.q = j
f.z = e
f.o = e
f.w = k
f.u = i
f.y = i
f.t = d
e.o = m
e.x = i
e.z = f
e.t = k
e.v = h
e.y = d
h.x = m
h.w = i
h.r = d
h.o = e
h.p = g
h.z = k
g.x = e
k.x = m
k.w = i
k.r = d
k.o = e
k.p = g
k.z = h
assert k.z.w.o.y.v.x.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: G = None
        self.u: B = None
        self.t: D = None
        self.o: F = None
        self.y: B = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
j = C("j")
d = D("d")
f = E("f")
e = F("e")
h = G("h")
g = C("g")
k = G("k")

m.r = g
i.o = f
i.y = f
i.t = g
i.v = j
j.x = e
d.t = f
d.q = j
f.z = e
f.o = e
f.w = k
f.u = i
f.y = i
f.t = d
e.o = m
e.x = i
e.z = f
e.t = k
e.v = h
e.y = d
h.x = m
h.w = i
h.r = d
h.o = e
h.p = g
h.z = k
g.x = e
k.x = m
k.w = i
k.r = d
k.o = e
k.p = g
k.z = h
assert k.z.w.o.y.v.x.o.r.txt == "g"