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

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

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

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

c = A("c")
d = B("d")
f = C("f")
l = D("l")

c.r = f
c.x = d
c.o = d
d.v = f
f.r = c
l.r = d
assert f.r.o.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: B = None
        self.o: B = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
f = C("f")
l = D("l")

c.r = f
c.x = d
c.o = d
d.v = f
f.r = c
l.r = d
assert f.r.o.v.r.txt == "c"