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

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

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

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

l = A("l")
d = B("d")
f = C("f")
m = D("m")
k = B("k")

l.p = f
l.s = f
d.p = l
d.u = m
d.z = m
d.o = k
f.r = k
m.v = l
m.o = k
k.p = l
k.u = m
k.z = m
k.o = d
assert k.p.s.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.txt = txt

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

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

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

l = A("l")
d = B("d")
f = C("f")
m = D("m")
k = B("k")

l.p = f
l.s = f
d.p = l
d.u = m
d.z = m
d.o = k
f.r = k
m.v = l
m.o = k
k.p = l
k.u = m
k.z = m
k.o = d
assert k.p.s.r.o.txt == "d"