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

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

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

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

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

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

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

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

d.u = b
d.v = m
m.o = c
m.t = l
m.s = d
f.w = c
f.p = d
f.y = d
a.o = d
a.s = d
a.t = l
c.u = f
c.v = j
j.o = d
j.s = d
j.t = l
b.w = d
b.p = d
b.y = d
l.w = d
l.p = d
l.y = c
assert d.v.t.w.v.txt == "m"