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

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

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

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

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

n.u = b
n.v = a
n.y = a
n.s = m
b.v = e
b.u = e
e.u = b
e.r = a
l.q = n
a.u = b
a.v = n
a.y = n
a.s = l
m.q = a
assert l.q.u.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: A = None
        self.s: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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

n.u = b
n.v = a
n.y = a
n.s = m
b.v = e
b.u = e
e.u = b
e.r = a
l.q = n
a.u = b
a.v = n
a.y = n
a.s = l
m.q = a
assert l.q.u.v.r.txt == "a"