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

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

l.u = a
l.p = n
l.v = i
d.v = j
d.u = h
d.p = c
d.y = a
e.z = n
h.p = j
j.p = h
n.u = a
n.p = m
n.v = c
a.v = h
a.u = j
a.p = e
a.y = d
i.z = n
c.z = m
m.u = d
m.p = l
m.v = i
assert e.z.u.y.u.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: A = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

l.u = a
l.p = n
l.v = i
d.v = j
d.u = h
d.p = c
d.y = a
e.z = n
h.p = j
j.p = h
n.u = a
n.p = m
n.v = c
a.v = h
a.u = j
a.p = e
a.y = d
i.z = n
c.z = m
m.u = d
m.p = l
m.v = i
assert e.z.u.y.u.p.p.txt == "h"