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

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

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

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

j = A("j")
n = B("n")
f = C("f")
b = D("b")
m = D("m")
a = D("a")

j.v = f
n.r = a
n.t = j
n.o = b
f.u = a
f.o = a
f.x = n
b.s = m
b.z = j
b.v = f
b.y = n
m.s = b
m.z = j
m.v = f
m.y = n
a.s = m
a.z = j
a.v = f
a.y = n
assert b.y.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
f = C("f")
b = D("b")
m = D("m")
a = D("a")

j.v = f
n.r = a
n.t = j
n.o = b
f.u = a
f.o = a
f.x = n
b.s = m
b.z = j
b.v = f
b.y = n
m.s = b
m.z = j
m.v = f
m.y = n
a.s = m
a.z = j
a.v = f
a.y = n
assert b.y.t.v.txt == "f"