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

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

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

d = A("d")
m = B("m")
j = C("j")
e = B("e")
f = C("f")
h = B("h")
c = C("c")
i = A("i")
g = C("g")
a = A("a")

d.u = i
m.t = e
m.s = h
m.v = h
j.r = a
j.q = e
j.v = m
e.t = h
e.s = m
e.v = m
f.r = i
f.q = e
f.v = m
h.t = m
h.s = m
h.v = m
c.r = a
c.q = m
c.v = h
i.u = a
g.r = d
g.q = h
g.v = e
a.u = d
assert i.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
j = C("j")
e = B("e")
f = C("f")
h = B("h")
c = C("c")
i = A("i")
g = C("g")
a = A("a")

d.u = i
m.t = e
m.s = h
m.v = h
j.r = a
j.q = e
j.v = m
e.t = h
e.s = m
e.v = m
f.r = i
f.q = e
f.v = m
h.t = m
h.s = m
h.v = m
c.r = a
c.q = m
c.v = h
i.u = a
g.r = d
g.q = h
g.v = e
a.u = d
assert i.u.u.u.u.txt == "a"