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

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

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

l = A("l")
h = B("h")
e = C("e")
k = A("k")
c = C("c")
a = C("a")
d = B("d")

l.s = h
h.x = k
h.w = l
h.v = d
e.y = k
e.o = a
e.w = l
k.s = h
c.y = k
c.w = k
c.o = a
a.y = k
a.o = c
a.w = l
d.x = l
d.w = k
d.v = h
assert l.s.v.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
e = C("e")
k = A("k")
c = C("c")
a = C("a")
d = B("d")

l.s = h
h.x = k
h.w = l
h.v = d
e.y = k
e.o = a
e.w = l
k.s = h
c.y = k
c.w = k
c.o = a
a.y = k
a.o = c
a.w = l
d.x = l
d.w = k
d.v = h
assert l.s.v.w.s.txt == "h"