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

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

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

k = A("k")
j = B("j")
i = C("i")
c = C("c")
d = A("d")
h = C("h")
g = A("g")
b = B("b")
e = C("e")

k.u = g
k.t = i
j.q = b
j.s = k
j.y = e
i.u = g
c.u = g
d.u = g
d.t = h
h.u = k
g.u = d
g.t = e
b.q = j
b.s = d
b.y = c
e.u = k
assert g.t.u.t.u.t.u.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: C = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
i = C("i")
c = C("c")
d = A("d")
h = C("h")
g = A("g")
b = B("b")
e = C("e")

k.u = g
k.t = i
j.q = b
j.s = k
j.y = e
i.u = g
c.u = g
d.u = g
d.t = h
h.u = k
g.u = d
g.t = e
b.q = j
b.s = d
b.y = c
e.u = k
assert g.t.u.t.u.t.u.t.u.u.txt == "d"