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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.txt = txt

n = A("n")
j = B("j")
b = C("b")
a = C("a")

n.y = j
n.t = j
j.x = a
j.t = n
b.r = j
b.x = j
a.r = j
a.x = j
assert b.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.txt = txt

n = A("n")
j = B("j")
b = C("b")
a = C("a")

n.y = j
n.t = j
j.x = a
j.t = n
b.r = j
b.x = j
a.r = j
a.x = j
assert b.x.x.x.txt == "j"