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

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

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

j = A("j")
k = B("k")
l = C("l")
a = A("a")
d = C("d")
c = B("c")
n = A("n")

j.w = a
k.u = c
k.r = c
k.w = c
l.q = d
a.w = n
d.q = l
c.u = k
c.r = k
c.w = k
n.w = a
assert k.w.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
l = C("l")
a = A("a")
d = C("d")
c = B("c")
n = A("n")

j.w = a
k.u = c
k.r = c
k.w = c
l.q = d
a.w = n
d.q = l
c.u = k
c.r = k
c.w = k
n.w = a
assert k.w.u.u.txt == "c"