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

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

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

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

n = A("n")
c = B("c")
e = C("e")
h = D("h")
i = A("i")
a = A("a")
b = D("b")

n.y = i
n.s = c
n.w = c
n.x = h
c.v = i
c.x = i
c.r = n
c.o = b
e.r = c
e.u = c
e.z = h
h.v = n
h.w = n
h.x = c
i.y = n
i.s = c
i.w = c
i.x = h
a.y = i
a.s = c
a.w = c
a.x = b
b.v = a
b.x = c
b.w = n
assert a.w.r.x.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: B = None
        self.w: B = None
        self.x: D = None
        self.txt = txt

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

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

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

n = A("n")
c = B("c")
e = C("e")
h = D("h")
i = A("i")
a = A("a")
b = D("b")

n.y = i
n.s = c
n.w = c
n.x = h
c.v = i
c.x = i
c.r = n
c.o = b
e.r = c
e.u = c
e.z = h
h.v = n
h.w = n
h.x = c
i.y = n
i.s = c
i.w = c
i.x = h
a.y = i
a.s = c
a.w = c
a.x = b
b.v = a
b.x = c
b.w = n
assert a.w.r.x.x.o.txt == "b"