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

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

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

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

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

a.y = i
a.s = c
e.q = c
l.v = a
l.u = k
l.s = k
l.w = e
b.u = i
b.p = e
b.t = c
b.v = k
k.u = a
k.p = e
k.t = l
k.v = b
c.v = i
c.u = b
c.s = b
c.w = e
i.y = a
i.s = c
assert c.w.q.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: C = None
        self.txt = txt

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

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

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

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

a.y = i
a.s = c
e.q = c
l.v = a
l.u = k
l.s = k
l.w = e
b.u = i
b.p = e
b.t = c
b.v = k
k.u = a
k.p = e
k.t = l
k.v = b
c.v = i
c.u = b
c.s = b
c.w = e
i.y = a
i.s = c
assert c.w.q.s.p.txt == "e"