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

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

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

c = A("c")
e = B("e")
f = C("f")
k = B("k")
i = C("i")
m = A("m")
a = A("a")

c.t = a
c.x = a
e.r = k
e.q = k
e.v = c
f.y = i
f.v = i
f.t = a
k.r = e
k.q = e
k.v = c
i.y = f
i.v = f
i.t = m
m.t = a
m.x = a
a.t = m
a.x = m
assert c.x.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: A = None
        self.txt = txt

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

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

c = A("c")
e = B("e")
f = C("f")
k = B("k")
i = C("i")
m = A("m")
a = A("a")

c.t = a
c.x = a
e.r = k
e.q = k
e.v = c
f.y = i
f.v = i
f.t = a
k.r = e
k.q = e
k.v = c
i.y = f
i.v = f
i.t = m
m.t = a
m.x = a
a.t = m
a.x = m
assert c.x.x.t.txt == "a"