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

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: A = None
        self.t: E = None
        self.p: I = None
        self.z: A = None
        self.v: E = None
        self.x: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: D = None
        self.y: E = None
        self.t: H = None
        self.r: F = None
        self.z: C = None
        self.v: H = None
        self.txt = txt

k = A("k")
b = B("b")
n = C("n")
l = D("l")
m = E("m")
j = F("j")
h = G("h")
c = H("c")
i = I("i")

k.p = n
b.t = l
b.w = l
b.x = h
b.q = j
b.u = j
b.y = k
n.q = k
l.w = k
l.p = m
m.o = n
m.p = b
j.o = l
j.p = m
h.p = m
c.y = k
c.q = k
c.z = k
c.t = m
c.v = m
c.p = i
c.x = j
i.x = b
i.w = l
i.y = m
i.t = c
i.v = c
i.r = j
i.z = n
assert k.p.q.p.q.p.q.p.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: A = None
        self.t: E = None
        self.p: I = None
        self.z: A = None
        self.v: E = None
        self.x: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: D = None
        self.y: E = None
        self.t: H = None
        self.r: F = None
        self.z: C = None
        self.v: H = None
        self.txt = txt

k = A("k")
b = B("b")
n = C("n")
l = D("l")
m = E("m")
j = F("j")
h = G("h")
c = H("c")
i = I("i")

k.p = n
b.t = l
b.w = l
b.x = h
b.q = j
b.u = j
b.y = k
n.q = k
l.w = k
l.p = m
m.o = n
m.p = b
j.o = l
j.p = m
h.p = m
c.y = k
c.q = k
c.z = k
c.t = m
c.v = m
c.p = i
c.x = j
i.x = b
i.w = l
i.y = m
i.t = c
i.v = c
i.r = j
i.z = n
assert k.p.q.p.q.p.q.p.q.p.txt == "n"