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

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

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

i = A("i")
j = B("j")
a = C("a")
b = A("b")
h = C("h")
l = B("l")
d = A("d")
n = A("n")

i.t = l
i.r = b
i.x = a
j.q = l
j.v = l
a.r = h
a.w = j
a.u = i
b.t = l
b.r = i
b.x = a
h.r = a
h.w = l
h.u = d
l.q = j
l.v = j
d.t = j
d.r = n
d.x = a
n.t = j
n.r = d
n.x = a
assert j.v.q.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: A = None
        self.x: C = None
        self.txt = txt

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

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

i = A("i")
j = B("j")
a = C("a")
b = A("b")
h = C("h")
l = B("l")
d = A("d")
n = A("n")

i.t = l
i.r = b
i.x = a
j.q = l
j.v = l
a.r = h
a.w = j
a.u = i
b.t = l
b.r = i
b.x = a
h.r = a
h.w = l
h.u = d
l.q = j
l.v = j
d.t = j
d.r = n
d.x = a
n.t = j
n.r = d
n.x = a
assert j.v.q.v.v.v.txt == "l"