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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

c = A("c")
b = B("b")
k = C("k")
i = D("i")
n = D("n")
f = B("f")
l = B("l")
a = C("a")
j = B("j")

c.z = i
b.x = a
b.p = a
b.y = n
k.p = f
i.y = b
n.y = j
f.x = a
f.y = n
f.p = k
l.x = k
l.y = i
l.p = a
a.p = l
j.x = a
j.y = n
j.p = k
assert i.y.y.y.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

c = A("c")
b = B("b")
k = C("k")
i = D("i")
n = D("n")
f = B("f")
l = B("l")
a = C("a")
j = B("j")

c.z = i
b.x = a
b.p = a
b.y = n
k.p = f
i.y = b
n.y = j
f.x = a
f.y = n
f.p = k
l.x = k
l.y = i
l.p = a
a.p = l
j.x = a
j.y = n
j.p = k
assert i.y.y.y.p.p.txt == "f"