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

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

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

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

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

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

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

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

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

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

k.y = b
k.q = f
k.v = i
k.x = c
c.u = b
b.w = f
b.v = n
b.q = k
b.y = d
a.v = d
a.o = k
f.w = b
f.v = n
f.q = k
f.y = a
d.v = a
d.o = k
n.y = b
n.q = b
n.v = c
n.x = i
e.u = b
i.u = b
assert e.u.v.q.y.o.x.u.w.txt == "f"