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

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

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

b = A("b")
j = B("j")
a = C("a")
f = B("f")
e = B("e")
d = C("d")
n = A("n")

b.x = e
j.v = b
j.y = b
a.t = f
a.z = n
a.q = e
f.v = n
f.y = n
e.v = b
e.y = n
d.t = e
d.q = e
d.z = b
n.x = f
assert b.x.y.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

b = A("b")
j = B("j")
a = C("a")
f = B("f")
e = B("e")
d = C("d")
n = A("n")

b.x = e
j.v = b
j.y = b
a.t = f
a.z = n
a.q = e
f.v = n
f.y = n
e.v = b
e.y = n
d.t = e
d.q = e
d.z = b
n.x = f
assert b.x.y.x.y.txt == "n"