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

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

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

j = A("j")
l = B("l")
c = C("c")
a = B("a")
n = A("n")
g = C("g")
h = A("h")
b = A("b")
f = C("f")

j.y = n
j.v = f
l.t = f
l.v = j
l.y = c
c.o = j
c.x = a
a.t = f
a.v = b
a.y = g
n.y = h
n.v = c
g.o = n
g.x = a
h.y = b
h.v = c
b.y = j
b.v = f
f.o = j
f.x = a
assert a.v.v.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: C = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
c = C("c")
a = B("a")
n = A("n")
g = C("g")
h = A("h")
b = A("b")
f = C("f")

j.y = n
j.v = f
l.t = f
l.v = j
l.y = c
c.o = j
c.x = a
a.t = f
a.v = b
a.y = g
n.y = h
n.v = c
g.o = n
g.x = a
h.y = b
h.v = c
b.y = j
b.v = f
f.o = j
f.x = a
assert a.v.v.x.t.txt == "f"