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

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

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

c = A("c")
j = B("j")
h = C("h")
i = C("i")
b = A("b")
d = C("d")
a = B("a")
f = C("f")

c.w = b
c.o = j
j.s = h
j.u = f
j.v = b
h.t = j
h.o = d
h.p = d
i.t = a
i.o = f
i.p = f
b.w = c
b.o = a
d.t = j
d.o = h
d.p = i
a.s = d
a.u = d
a.v = c
f.t = j
f.o = d
f.p = h
assert a.v.w.o.u.t.v.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
h = C("h")
i = C("i")
b = A("b")
d = C("d")
a = B("a")
f = C("f")

c.w = b
c.o = j
j.s = h
j.u = f
j.v = b
h.t = j
h.o = d
h.p = d
i.t = a
i.o = f
i.p = f
b.w = c
b.o = a
d.t = j
d.o = h
d.p = i
a.s = d
a.u = d
a.v = c
f.t = j
f.o = d
f.p = h
assert a.v.w.o.u.t.v.w.w.txt == "b"