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

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

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

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

n = A("n")
e = B("e")
b = C("b")
h = D("h")
f = A("f")
k = B("k")
j = A("j")
c = D("c")

n.w = k
n.s = j
n.v = f
e.u = c
b.v = f
h.u = f
h.y = e
h.w = k
f.w = e
f.s = n
f.v = n
k.u = c
j.w = k
j.s = n
j.v = f
c.u = n
c.y = e
c.w = e
assert k.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: A = None
        self.v: A = None
        self.txt = txt

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

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

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

n = A("n")
e = B("e")
b = C("b")
h = D("h")
f = A("f")
k = B("k")
j = A("j")
c = D("c")

n.w = k
n.s = j
n.v = f
e.u = c
b.v = f
h.u = f
h.y = e
h.w = k
f.w = e
f.s = n
f.v = n
k.u = c
j.w = k
j.s = n
j.v = f
c.u = n
c.y = e
c.w = e
assert k.u.w.u.txt == "c"