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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: D = None
        self.o: A = None
        self.v: B = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
e = C("e")
j = D("j")
m = C("m")
k = D("k")
i = B("i")

b.v = i
d.s = b
d.o = b
d.p = k
d.v = i
e.o = m
e.t = m
e.y = j
j.v = d
j.o = b
j.y = k
j.z = i
m.o = e
m.t = e
m.y = j
k.v = d
k.o = b
k.y = j
k.z = i
i.s = b
i.o = b
i.p = j
i.v = d
assert k.y.o.v.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: D = None
        self.o: A = None
        self.v: B = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
e = C("e")
j = D("j")
m = C("m")
k = D("k")
i = B("i")

b.v = i
d.s = b
d.o = b
d.p = k
d.v = i
e.o = m
e.t = m
e.y = j
j.v = d
j.o = b
j.y = k
j.z = i
m.o = e
m.t = e
m.y = j
k.v = d
k.o = b
k.y = j
k.z = i
i.s = b
i.o = b
i.p = j
i.v = d
assert k.y.o.v.v.o.v.txt == "i"