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

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

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

j = A("j")
n = B("n")
b = C("b")
f = C("f")
c = B("c")

j.u = n
j.o = f
n.q = f
n.v = j
n.y = c
b.t = f
b.x = c
b.v = j
f.t = b
f.x = n
f.v = j
c.q = f
c.v = j
c.y = n
assert n.v.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: C = None
        self.txt = txt

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

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

j = A("j")
n = B("n")
b = C("b")
f = C("f")
c = B("c")

j.u = n
j.o = f
n.q = f
n.v = j
n.y = c
b.t = f
b.x = c
b.v = j
f.t = b
f.x = n
f.v = j
c.q = f
c.v = j
c.y = n
assert n.v.o.x.txt == "n"