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

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

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

l = A("l")
b = B("b")
k = C("k")
a = B("a")
j = A("j")

l.t = b
l.v = j
l.z = k
b.w = k
b.v = k
b.y = a
k.y = j
k.z = b
a.w = k
a.v = k
a.y = b
j.t = b
j.v = l
j.z = k
assert j.t.v.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.z: C = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
k = C("k")
a = B("a")
j = A("j")

l.t = b
l.v = j
l.z = k
b.w = k
b.v = k
b.y = a
k.y = j
k.z = b
a.w = k
a.v = k
a.y = b
j.t = b
j.v = l
j.z = k
assert j.t.v.z.v.txt == "k"