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

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

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

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

j = A("j")
n = B("n")
l = C("l")
d = D("d")
e = C("e")
m = D("m")
k = A("k")

j.r = n
j.s = n
n.v = j
n.t = j
n.p = d
n.y = k
l.o = n
l.z = e
d.p = j
d.v = n
d.y = m
e.o = n
e.z = l
m.p = j
m.v = n
m.y = d
k.r = n
k.s = n
assert m.y.p.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: B = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
l = C("l")
d = D("d")
e = C("e")
m = D("m")
k = A("k")

j.r = n
j.s = n
n.v = j
n.t = j
n.p = d
n.y = k
l.o = n
l.z = e
d.p = j
d.v = n
d.y = m
e.o = n
e.z = l
m.p = j
m.v = n
m.y = d
k.r = n
k.s = n
assert m.y.p.s.t.txt == "j"