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

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

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

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

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

d.u = l
d.z = n
d.r = n
e.u = d
e.o = d
e.r = f
e.v = a
a.u = e
a.p = f
h.w = a
h.p = l
h.o = d
h.u = n
l.w = a
l.p = h
l.o = d
l.u = e
n.u = d
n.o = d
n.r = f
n.v = f
f.u = n
f.p = a
assert l.p.o.z.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: B = None
        self.r: B = None
        self.txt = txt

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

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

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

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

d.u = l
d.z = n
d.r = n
e.u = d
e.o = d
e.r = f
e.v = a
a.u = e
a.p = f
h.w = a
h.p = l
h.o = d
h.u = n
l.w = a
l.p = h
l.o = d
l.u = e
n.u = d
n.o = d
n.r = f
n.v = f
f.u = n
f.p = a
assert l.p.o.z.r.p.txt == "a"