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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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