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

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

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

a = A("a")
j = B("j")
f = C("f")
l = A("l")
h = C("h")
b = A("b")
m = C("m")
d = C("d")

a.o = f
a.w = f
a.s = l
j.x = b
j.v = a
f.t = m
f.x = j
f.z = j
l.o = d
l.w = d
l.s = b
h.t = d
h.x = j
h.z = j
b.o = d
b.w = f
b.s = l
m.t = h
m.x = j
m.z = j
d.t = m
d.x = j
d.z = j
assert d.x.v.w.t.x.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: C = None
        self.s: A = None
        self.txt = txt

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

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

a = A("a")
j = B("j")
f = C("f")
l = A("l")
h = C("h")
b = A("b")
m = C("m")
d = C("d")

a.o = f
a.w = f
a.s = l
j.x = b
j.v = a
f.t = m
f.x = j
f.z = j
l.o = d
l.w = d
l.s = b
h.t = d
h.x = j
h.z = j
b.o = d
b.w = f
b.s = l
m.t = h
m.x = j
m.z = j
d.t = m
d.x = j
d.z = j
assert d.x.v.w.t.x.x.w.txt == "f"