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

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

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

a = A("a")
f = B("f")
m = C("m")
j = A("j")
n = C("n")
b = A("b")
l = A("l")
g = A("g")
i = B("i")

a.q = m
a.p = m
f.r = i
f.u = i
f.t = n
m.u = i
m.q = j
m.p = n
j.q = n
j.p = n
n.u = i
n.q = b
n.p = m
b.q = n
b.p = n
l.q = n
l.p = m
g.q = n
g.p = m
i.r = f
i.u = f
i.t = n
assert f.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: C = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
m = C("m")
j = A("j")
n = C("n")
b = A("b")
l = A("l")
g = A("g")
i = B("i")

a.q = m
a.p = m
f.r = i
f.u = i
f.t = n
m.u = i
m.q = j
m.p = n
j.q = n
j.p = n
n.u = i
n.q = b
n.p = m
b.q = n
b.p = n
l.q = n
l.p = m
g.q = n
g.p = m
i.r = f
i.u = f
i.t = n
assert f.t.u.u.txt == "f"