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

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

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

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

e = A("e")
n = B("n")
d = C("d")
c = D("c")
m = A("m")

e.y = n
e.p = d
e.v = d
e.w = m
n.v = c
d.r = c
d.v = c
d.p = c
c.x = m
m.y = n
m.p = d
m.v = d
m.w = e
assert e.v.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: C = None
        self.v: C = None
        self.w: A = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
d = C("d")
c = D("c")
m = A("m")

e.y = n
e.p = d
e.v = d
e.w = m
n.v = c
d.r = c
d.v = c
d.p = c
c.x = m
m.y = n
m.p = d
m.v = d
m.w = e
assert e.v.p.x.txt == "m"