class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: B = None
        self.y: B = None
        self.q: C = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
d = C("d")
l = D("l")

e.p = d
e.q = d
e.x = n
e.y = n
n.y = d
n.p = d
n.t = l
n.v = l
d.y = n
d.q = l
d.o = e
l.x = n
assert n.v.x.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: B = None
        self.y: B = None
        self.q: C = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
d = C("d")
l = D("l")

e.p = d
e.q = d
e.x = n
e.y = n
n.y = d
n.p = d
n.t = l
n.v = l
d.y = n
d.q = l
d.o = e
l.x = n
assert n.v.x.p.y.txt == "n"