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

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

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

k = A("k")
a = B("a")
g = C("g")
e = C("e")
c = B("c")
f = A("f")
j = B("j")

k.u = e
k.x = f
k.t = f
a.w = e
g.t = e
g.q = f
g.p = f
e.t = g
e.q = k
e.p = f
c.w = g
f.u = g
f.x = k
f.t = k
j.w = e
assert j.w.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: A = None
        self.t: A = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
g = C("g")
e = C("e")
c = B("c")
f = A("f")
j = B("j")

k.u = e
k.x = f
k.t = f
a.w = e
g.t = e
g.q = f
g.p = f
e.t = g
e.q = k
e.p = f
c.w = g
f.u = g
f.x = k
f.t = k
j.w = e
assert j.w.q.x.txt == "f"