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

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

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

i = A("i")
c = B("c")
l = C("l")
e = A("e")
m = C("m")
j = C("j")
n = B("n")
k = A("k")
f = A("f")
d = C("d")

i.p = k
c.x = l
c.q = l
c.v = f
l.u = d
l.v = i
l.p = j
e.p = k
m.u = j
m.v = i
m.p = d
j.u = d
j.p = d
j.v = e
n.x = l
n.q = m
n.v = k
k.p = f
f.p = e
d.u = l
d.v = f
d.p = j
assert m.p.u.v.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
l = C("l")
e = A("e")
m = C("m")
j = C("j")
n = B("n")
k = A("k")
f = A("f")
d = C("d")

i.p = k
c.x = l
c.q = l
c.v = f
l.u = d
l.v = i
l.p = j
e.p = k
m.u = j
m.v = i
m.p = d
j.u = d
j.p = d
j.v = e
n.x = l
n.q = m
n.v = k
k.p = f
f.p = e
d.u = l
d.v = f
d.p = j
assert m.p.u.v.p.p.p.p.txt == "k"