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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: E = None
        self.u: A = None
        self.z: B = None
        self.txt = txt

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

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

a = A("a")
k = B("k")
d = C("d")
e = D("e")
b = E("b")
n = F("n")
m = D("m")
j = A("j")
i = F("i")

a.q = k
a.o = k
k.y = d
k.p = b
d.s = a
d.r = b
d.t = e
e.y = b
e.r = b
e.u = j
e.z = k
b.u = k
b.v = k
b.z = a
b.s = d
b.y = d
b.t = i
n.o = i
m.y = b
m.r = b
m.u = a
m.z = k
j.q = k
j.o = k
i.o = n
assert i.o.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: E = None
        self.u: A = None
        self.z: B = None
        self.txt = txt

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

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

a = A("a")
k = B("k")
d = C("d")
e = D("e")
b = E("b")
n = F("n")
m = D("m")
j = A("j")
i = F("i")

a.q = k
a.o = k
k.y = d
k.p = b
d.s = a
d.r = b
d.t = e
e.y = b
e.r = b
e.u = j
e.z = k
b.u = k
b.v = k
b.z = a
b.s = d
b.y = d
b.t = i
n.o = i
m.y = b
m.r = b
m.u = a
m.z = k
j.q = k
j.o = k
i.o = n
assert i.o.o.o.o.o.o.o.o.o.txt == "n"