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

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

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

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

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

e.u = d
k.y = e
k.s = n
k.w = g
f.w = k
f.v = d
d.x = g
n.y = e
n.s = g
n.w = k
g.y = e
g.s = n
g.w = n
assert n.y.u.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

e.u = d
k.y = e
k.s = n
k.w = g
f.w = k
f.v = d
d.x = g
n.y = e
n.s = g
n.w = k
g.y = e
g.s = n
g.w = n
assert n.y.u.x.s.txt == "n"