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

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

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

f = A("f")
l = B("l")
g = C("g")
h = C("h")
c = A("c")
e = C("e")
j = B("j")
a = C("a")
n = A("n")

f.o = j
l.s = n
l.w = n
l.r = g
g.v = f
g.q = h
h.v = f
h.q = a
c.o = j
e.v = c
e.q = g
j.s = c
j.w = f
j.r = g
a.v = c
a.q = h
n.o = l
assert h.q.v.o.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
g = C("g")
h = C("h")
c = A("c")
e = C("e")
j = B("j")
a = C("a")
n = A("n")

f.o = j
l.s = n
l.w = n
l.r = g
g.v = f
g.q = h
h.v = f
h.q = a
c.o = j
e.v = c
e.q = g
j.s = c
j.w = f
j.r = g
a.v = c
a.q = h
n.o = l
assert h.q.v.o.w.o.txt == "j"