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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: B = None
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: D = None
        self.v: D = None
        self.t: C = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: B = None
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: D = None
        self.v: D = None
        self.t: C = None
        self.o: E = None
        self.txt = txt

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

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