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

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

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

b = A("b")
j = B("j")
h = C("h")
g = C("g")
e = A("e")
f = B("f")
n = B("n")
i = A("i")

b.q = g
b.r = e
b.o = h
j.w = b
j.q = n
j.s = g
h.u = g
g.u = h
e.q = h
e.r = i
e.o = g
f.w = i
f.q = j
f.s = g
n.w = i
n.q = f
n.s = g
i.q = g
i.r = b
i.o = h
assert e.q.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: A = None
        self.o: C = None
        self.txt = txt

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

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

b = A("b")
j = B("j")
h = C("h")
g = C("g")
e = A("e")
f = B("f")
n = B("n")
i = A("i")

b.q = g
b.r = e
b.o = h
j.w = b
j.q = n
j.s = g
h.u = g
g.u = h
e.q = h
e.r = i
e.o = g
f.w = i
f.q = j
f.s = g
n.w = i
n.q = f
n.s = g
i.q = g
i.r = b
i.o = h
assert e.q.u.u.u.txt == "g"