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

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.v: A = None
        self.txt = txt

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

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

a.y = b
a.p = b
a.v = e
l.t = h
l.z = e
d.q = e
d.s = e
d.v = a
n.r = e
n.w = l
n.v = h
n.s = h
b.t = n
b.z = e
e.q = d
e.s = d
e.v = a
h.r = d
h.w = b
h.v = n
h.s = n
assert d.s.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: C = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.v: A = None
        self.txt = txt

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

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

a.y = b
a.p = b
a.v = e
l.t = h
l.z = e
d.q = e
d.s = e
d.v = a
n.r = e
n.w = l
n.v = h
n.s = h
b.t = n
b.z = e
e.q = d
e.s = d
e.v = a
h.r = d
h.w = b
h.v = n
h.s = n
assert d.s.v.v.v.txt == "a"