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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: E = None
        self.x: A = None
        self.p: C = None
        self.r: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: B = None
        self.p: A = None
        self.s: D = None
        self.z: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: F = None
        self.s: B = None
        self.w: B = None
        self.q: C = None
        self.txt = txt

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

k = A("k")
n = B("n")
e = C("e")
f = D("f")
g = E("g")
m = F("m")
c = C("c")
d = A("d")
a = C("a")
i = D("i")

k.p = c
n.t = g
n.q = d
n.x = k
e.v = a
e.p = a
e.o = g
e.x = d
e.r = c
f.q = d
f.w = n
f.p = k
f.s = i
f.z = i
g.t = c
g.o = m
g.s = n
g.w = n
g.q = e
m.r = f
c.v = e
c.p = e
c.r = e
c.o = g
c.x = k
d.p = a
a.v = e
a.p = e
a.r = e
a.o = g
a.x = d
i.q = k
i.p = k
i.w = n
i.s = f
i.z = f
assert i.q.p.x.p.x.p.r.x.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: E = None
        self.x: A = None
        self.p: C = None
        self.r: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: B = None
        self.p: A = None
        self.s: D = None
        self.z: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: F = None
        self.s: B = None
        self.w: B = None
        self.q: C = None
        self.txt = txt

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

k = A("k")
n = B("n")
e = C("e")
f = D("f")
g = E("g")
m = F("m")
c = C("c")
d = A("d")
a = C("a")
i = D("i")

k.p = c
n.t = g
n.q = d
n.x = k
e.v = a
e.p = a
e.o = g
e.x = d
e.r = c
f.q = d
f.w = n
f.p = k
f.s = i
f.z = i
g.t = c
g.o = m
g.s = n
g.w = n
g.q = e
m.r = f
c.v = e
c.p = e
c.r = e
c.o = g
c.x = k
d.p = a
a.v = e
a.p = e
a.r = e
a.o = g
a.x = d
i.q = k
i.p = k
i.w = n
i.s = f
i.z = f
assert i.q.p.x.p.x.p.r.x.p.x.txt == "d"