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

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

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

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

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

b.w = n
b.s = n
b.t = f
b.y = l
n.s = f
n.t = f
k.s = l
k.q = b
k.u = n
g.r = n
f.s = l
f.q = b
f.u = n
l.r = n
d.r = n
assert k.u.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: B = None
        self.t: C = None
        self.y: D = None
        self.txt = txt

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

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

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

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

b.w = n
b.s = n
b.t = f
b.y = l
n.s = f
n.t = f
k.s = l
k.q = b
k.u = n
g.r = n
f.s = l
f.q = b
f.u = n
l.r = n
d.r = n
assert k.u.t.q.y.txt == "l"