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

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

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

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

f = A("f")
c = B("c")
l = C("l")
a = D("a")
j = A("j")
i = D("i")
m = C("m")

f.o = a
f.w = j
c.w = j
c.t = a
l.v = m
l.z = j
l.t = i
a.u = l
a.v = m
a.o = i
j.o = a
j.w = f
i.u = l
i.v = m
i.o = a
m.v = l
m.z = f
m.t = a
assert l.t.v.z.o.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: A = None
        self.txt = txt

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

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

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

f = A("f")
c = B("c")
l = C("l")
a = D("a")
j = A("j")
i = D("i")
m = C("m")

f.o = a
f.w = j
c.w = j
c.t = a
l.v = m
l.z = j
l.t = i
a.u = l
a.v = m
a.o = i
j.o = a
j.w = f
i.u = l
i.v = m
i.o = a
m.v = l
m.z = f
m.t = a
assert l.t.v.z.o.v.z.txt == "f"