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

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

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

g = A("g")
n = B("n")
j = C("j")
c = B("c")
i = B("i")
b = B("b")
a = A("a")
h = C("h")

g.t = a
g.u = a
n.u = g
j.q = h
c.u = a
i.u = a
b.u = a
a.t = g
a.u = g
h.q = j
assert g.u.u.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
j = C("j")
c = B("c")
i = B("i")
b = B("b")
a = A("a")
h = C("h")

g.t = a
g.u = a
n.u = g
j.q = h
c.u = a
i.u = a
b.u = a
a.t = g
a.u = g
h.q = j
assert g.u.u.t.t.t.t.t.txt == "a"