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

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

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

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

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

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

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

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

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

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

l.y = h
l.p = d
l.r = b
k.t = l
k.w = n
h.v = f
h.s = e
n.z = e
n.t = b
n.x = h
f.y = h
f.p = d
f.r = k
b.t = f
b.w = n
e.z = n
e.t = k
e.x = h
d.y = h
d.p = l
d.r = k
assert d.y.s.x.v.txt == "f"