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

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

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

i = A("i")
a = B("a")
f = C("f")
b = C("b")
k = C("k")
l = A("l")

i.y = a
i.q = l
i.u = f
a.t = l
f.u = l
b.u = i
k.u = l
l.y = a
l.q = i
l.u = f
assert a.t.u.u.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: A = None
        self.u: C = None
        self.txt = txt

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

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

i = A("i")
a = B("a")
f = C("f")
b = C("b")
k = C("k")
l = A("l")

i.y = a
i.q = l
i.u = f
a.t = l
f.u = l
b.u = i
k.u = l
l.y = a
l.q = i
l.u = f
assert a.t.u.u.y.t.txt == "l"