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

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

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

l = A("l")
e = B("e")
i = C("i")
g = A("g")
d = B("d")
n = C("n")
k = B("k")

l.v = e
l.x = g
l.y = k
e.v = l
e.o = d
e.w = k
i.s = n
i.q = n
i.p = l
g.v = k
g.x = l
g.y = e
d.v = g
d.o = k
d.w = k
n.s = i
n.q = i
n.p = l
k.v = l
k.o = e
k.w = d
assert n.p.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: A = None
        self.y: B = None
        self.txt = txt

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

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

l = A("l")
e = B("e")
i = C("i")
g = A("g")
d = B("d")
n = C("n")
k = B("k")

l.v = e
l.x = g
l.y = k
e.v = l
e.o = d
e.w = k
i.s = n
i.q = n
i.p = l
g.v = k
g.x = l
g.y = e
d.v = g
d.o = k
d.w = k
n.s = i
n.q = i
n.p = l
k.v = l
k.o = e
k.w = d
assert n.p.v.v.txt == "l"