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

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

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

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

l.z = j
l.v = i
f.z = n
f.p = i
i.u = j
i.p = l
j.u = i
j.p = l
n.z = f
n.p = i
d.z = i
d.v = j
c.z = i
c.v = j
assert c.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

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

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

l.z = j
l.v = i
f.z = n
f.p = i
i.u = j
i.p = l
j.u = i
j.p = l
n.z = f
n.p = i
d.z = i
d.v = j
c.z = i
c.v = j
assert c.z.p.z.txt == "j"