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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.s: G = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: B = None
        self.r: C = None
        self.v: D = None
        self.w: C = None
        self.y: E = None
        self.o: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: E = None
        self.u: E = None
        self.w: B = None
        self.txt = txt

g = A("g")
n = B("n")
f = C("f")
b = D("b")
j = E("j")
h = F("h")
i = G("i")
e = E("e")
d = G("d")
c = B("c")

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.s: G = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: B = None
        self.r: C = None
        self.v: D = None
        self.w: C = None
        self.y: E = None
        self.o: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: E = None
        self.u: E = None
        self.w: B = None
        self.txt = txt

g = A("g")
n = B("n")
f = C("f")
b = D("b")
j = E("j")
h = F("h")
i = G("i")
e = E("e")
d = G("d")
c = B("c")

g.o = i
g.w = h
g.q = h
g.x = b
n.r = h
f.u = g
f.y = j
f.r = e
f.v = e
f.t = n
b.o = f
b.q = g
b.s = i
b.w = n
j.p = b
j.v = b
j.z = c
j.r = f
j.w = f
j.y = e
j.o = n
h.p = c
h.z = d
i.z = f
i.p = j
i.u = e
i.w = n
e.p = b
e.v = b
e.z = c
e.o = c
e.r = f
e.w = f
e.y = j
d.z = f
d.p = e
d.u = e
d.w = n
c.r = h
assert c.r.p.r.p.r.z.p.r.r.r.txt == "f"