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

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

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

l = A("l")
i = B("i")
g = C("g")
d = B("d")
f = B("f")
b = B("b")
n = A("n")
h = C("h")

l.o = n
l.v = g
i.y = d
i.u = d
g.w = h
g.y = h
d.y = i
d.u = b
f.y = i
f.u = i
b.y = d
b.u = i
n.o = l
n.v = g
h.w = g
h.y = g
assert h.y.w.y.w.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

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

l = A("l")
i = B("i")
g = C("g")
d = B("d")
f = B("f")
b = B("b")
n = A("n")
h = C("h")

l.o = n
l.v = g
i.y = d
i.u = d
g.w = h
g.y = h
d.y = i
d.u = b
f.y = i
f.u = i
b.y = d
b.u = i
n.o = l
n.v = g
h.w = g
h.y = g
assert h.y.w.y.w.w.y.txt == "h"