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

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

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

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

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

l.v = a
l.x = j
l.o = e
c.r = e
c.s = e
j.r = e
j.p = e
e.y = a
a.v = l
a.x = j
a.o = e
assert e.y.x.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

l.v = a
l.x = j
l.o = e
c.r = e
c.s = e
j.r = e
j.p = e
e.y = a
a.v = l
a.x = j
a.o = e
assert e.y.x.p.y.txt == "a"