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

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

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

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

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

c.x = d
n.p = e
e.x = h
e.v = d
e.o = d
e.r = i
h.u = e
h.o = e
h.p = n
h.v = d
l.p = e
d.p = e
i.u = e
i.o = e
i.p = n
i.v = n
assert d.p.x.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

c.x = d
n.p = e
e.x = h
e.v = d
e.o = d
e.r = i
h.u = e
h.o = e
h.p = n
h.v = d
l.p = e
d.p = e
i.u = e
i.o = e
i.p = n
i.v = n
assert d.p.x.o.r.txt == "i"