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

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

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

g = A("g")
d = B("d")
k = C("k")
f = B("f")
n = A("n")
i = C("i")
j = C("j")
m = B("m")
a = C("a")
c = A("c")

g.o = n
g.u = c
d.r = a
d.x = f
k.y = n
k.s = d
k.t = j
f.r = i
f.x = d
n.o = c
n.u = c
i.y = n
i.s = d
i.t = j
j.y = g
j.s = f
j.t = k
m.r = j
m.x = d
a.y = g
a.s = m
a.t = k
c.o = g
c.u = n
assert j.t.y.o.u.o.u.u.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: A = None
        self.txt = txt

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

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

g = A("g")
d = B("d")
k = C("k")
f = B("f")
n = A("n")
i = C("i")
j = C("j")
m = B("m")
a = C("a")
c = A("c")

g.o = n
g.u = c
d.r = a
d.x = f
k.y = n
k.s = d
k.t = j
f.r = i
f.x = d
n.o = c
n.u = c
i.y = n
i.s = d
i.t = j
j.y = g
j.s = f
j.t = k
m.r = j
m.x = d
a.y = g
a.s = m
a.t = k
c.o = g
c.u = n
assert j.t.y.o.u.o.u.u.o.o.o.txt == "c"