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

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

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

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

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

n.r = b
n.o = b
n.v = e
a.q = e
a.x = i
a.s = k
a.w = d
e.w = d
e.o = i
i.u = d
i.p = e
i.v = b
d.q = e
d.x = i
d.s = a
d.w = k
b.r = n
b.o = n
b.v = e
c.w = d
c.o = i
k.q = c
k.x = i
k.s = a
k.w = d
assert a.q.o.u.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: C = None
        self.o: A = None
        self.txt = txt

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

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

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

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

n.r = b
n.o = b
n.v = e
a.q = e
a.x = i
a.s = k
a.w = d
e.w = d
e.o = i
i.u = d
i.p = e
i.v = b
d.q = e
d.x = i
d.s = a
d.w = k
b.r = n
b.o = n
b.v = e
c.w = d
c.o = i
k.q = c
k.x = i
k.s = a
k.w = d
assert a.q.o.u.q.o.txt == "i"