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

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

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

c = A("c")
b = B("b")
l = C("l")
j = B("j")
e = A("e")
i = A("i")
f = B("f")
m = C("m")
g = C("g")
k = C("k")

c.y = i
c.u = f
b.s = k
b.q = c
b.p = l
l.y = c
l.w = g
j.s = g
j.q = c
j.p = l
e.y = i
e.u = j
i.y = c
i.u = f
f.s = g
f.q = e
f.p = l
m.y = e
m.w = l
g.y = c
g.w = l
k.y = e
k.w = g
assert e.u.q.u.s.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
l = C("l")
j = B("j")
e = A("e")
i = A("i")
f = B("f")
m = C("m")
g = C("g")
k = C("k")

c.y = i
c.u = f
b.s = k
b.q = c
b.p = l
l.y = c
l.w = g
j.s = g
j.q = c
j.p = l
e.y = i
e.u = j
i.y = c
i.u = f
f.s = g
f.q = e
f.p = l
m.y = e
m.w = l
g.y = c
g.w = l
k.y = e
k.w = g
assert e.u.q.u.s.w.w.txt == "g"