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

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

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

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

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

e.y = n
f.y = n
n.u = f
n.o = f
n.s = f
n.w = k
l.w = n
l.r = e
l.y = k
k.w = n
k.r = e
k.y = l
assert n.o.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

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

e.y = n
f.y = n
n.u = f
n.o = f
n.s = f
n.w = k
l.w = n
l.r = e
l.y = k
k.w = n
k.r = e
k.y = l
assert n.o.y.w.txt == "k"