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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: F = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.w: A = None
        self.s: F = None
        self.txt = txt

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

d = A("d")
l = B("l")
m = C("m")
f = D("f")
g = E("g")
h = F("h")
k = C("k")
n = E("n")

d.z = l
d.p = l
d.q = n
d.o = h
l.s = h
m.r = k
f.o = l
f.z = h
f.t = h
g.r = h
g.s = h
g.t = l
g.w = d
h.u = n
h.t = g
h.w = l
h.r = f
h.x = d
k.r = m
n.r = h
n.s = h
n.t = l
n.w = d
assert m.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: B = None
        self.q: E = None
        self.o: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: F = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.w: A = None
        self.s: F = None
        self.txt = txt

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

d = A("d")
l = B("l")
m = C("m")
f = D("f")
g = E("g")
h = F("h")
k = C("k")
n = E("n")

d.z = l
d.p = l
d.q = n
d.o = h
l.s = h
m.r = k
f.o = l
f.z = h
f.t = h
g.r = h
g.s = h
g.t = l
g.w = d
h.u = n
h.t = g
h.w = l
h.r = f
h.x = d
k.r = m
n.r = h
n.s = h
n.t = l
n.w = d
assert m.r.r.r.r.r.r.r.r.txt == "m"