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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.w: B = None
        self.txt = txt

c = A("c")
l = B("l")
f = C("f")
k = D("k")
n = D("n")

c.z = f
l.z = f
l.o = n
f.p = c
f.v = c
f.t = c
k.v = f
k.t = n
k.w = l
n.v = f
n.t = k
n.w = l
assert f.v.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.w: B = None
        self.txt = txt

c = A("c")
l = B("l")
f = C("f")
k = D("k")
n = D("n")

c.z = f
l.z = f
l.o = n
f.p = c
f.v = c
f.t = c
k.v = f
k.t = n
k.w = l
n.v = f
n.t = k
n.w = l
assert f.v.z.p.txt == "c"