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

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

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

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

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

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

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

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

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