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

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

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

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

f = A("f")
l = B("l")
e = C("e")
j = D("j")
c = A("c")

f.s = c
f.p = l
l.o = c
l.z = c
l.r = j
l.x = e
e.v = l
j.t = f
c.s = f
c.p = l
assert l.r.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: B = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
e = C("e")
j = D("j")
c = A("c")

f.s = c
f.p = l
l.o = c
l.z = c
l.r = j
l.x = e
e.v = l
j.t = f
c.s = f
c.p = l
assert l.r.t.p.txt == "l"