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

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.w: D = None
        self.s: F = None
        self.v: E = None
        self.y: C = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: G = None
        self.u: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: E = None
        self.txt = txt

h = A("h")
g = B("g")
m = C("m")
k = D("k")
f = E("f")
n = F("n")
b = G("b")
i = E("i")
d = F("d")
a = A("a")

h.o = d
g.x = b
g.w = k
g.s = d
g.v = i
g.z = i
g.y = m
m.p = g
m.x = b
m.u = a
k.w = a
k.v = b
k.x = d
k.o = m
f.s = n
f.y = g
f.v = g
f.o = m
n.r = d
b.t = n
b.u = i
i.s = n
i.y = g
i.v = g
i.o = m
d.r = n
a.o = n
assert n.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.w: D = None
        self.s: F = None
        self.v: E = None
        self.y: C = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: G = None
        self.u: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: E = None
        self.txt = txt

h = A("h")
g = B("g")
m = C("m")
k = D("k")
f = E("f")
n = F("n")
b = G("b")
i = E("i")
d = F("d")
a = A("a")

h.o = d
g.x = b
g.w = k
g.s = d
g.v = i
g.z = i
g.y = m
m.p = g
m.x = b
m.u = a
k.w = a
k.v = b
k.x = d
k.o = m
f.s = n
f.y = g
f.v = g
f.o = m
n.r = d
b.t = n
b.u = i
i.s = n
i.y = g
i.v = g
i.o = m
d.r = n
a.o = n
assert n.r.r.r.r.r.txt == "d"