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

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

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

k = A("k")
n = B("n")
j = C("j")
g = A("g")
d = B("d")

k.u = j
n.x = j
n.v = j
n.t = d
j.x = g
j.v = d
g.u = j
d.x = j
d.v = j
d.t = n
assert j.v.v.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
j = C("j")
g = A("g")
d = B("d")

k.u = j
n.x = j
n.v = j
n.t = d
j.x = g
j.v = d
g.u = j
d.x = j
d.v = j
d.t = n
assert j.v.v.x.u.txt == "j"