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

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

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

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

a.q = i
a.t = h
e.r = d
e.y = d
e.t = c
c.w = e
c.u = h
f.r = d
f.y = d
f.t = j
h.q = l
h.t = a
j.w = d
j.u = h
d.r = e
d.y = e
d.t = c
i.w = d
i.u = h
l.w = d
l.u = h
assert l.w.y.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: A = None
        self.txt = txt

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

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

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

a.q = i
a.t = h
e.r = d
e.y = d
e.t = c
c.w = e
c.u = h
f.r = d
f.y = d
f.t = j
h.q = l
h.t = a
j.w = d
j.u = h
d.r = e
d.y = e
d.t = c
i.w = d
i.u = h
l.w = d
l.u = h
assert l.w.y.r.r.txt == "e"