class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: C = None
        self.y: D = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

b.u = m
b.z = l
b.y = f
b.q = i
i.z = a
i.r = n
i.y = b
i.w = m
l.s = m
l.r = e
n.r = i
e.r = i
f.r = i
m.u = a
m.z = l
m.y = n
m.q = i
a.u = m
a.z = l
a.y = e
a.q = i
assert n.r.z.u.z.r.r.y.txt == "b"