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

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

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

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

b = A("b")
c = B("c")
n = C("n")
d = D("d")
f = B("f")
e = C("e")
a = B("a")

b.r = e
b.v = d
c.p = f
c.z = e
n.p = b
n.u = f
n.o = f
n.s = d
d.u = b
d.v = b
f.p = a
f.z = e
e.p = b
e.u = c
e.o = f
e.s = d
a.p = c
a.z = n
assert c.p.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: D = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
n = C("n")
d = D("d")
f = B("f")
e = C("e")
a = B("a")

b.r = e
b.v = d
c.p = f
c.z = e
n.p = b
n.u = f
n.o = f
n.s = d
d.u = b
d.v = b
f.p = a
f.z = e
e.p = b
e.u = c
e.o = f
e.s = d
a.p = c
a.z = n
assert c.p.z.o.txt == "f"