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

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

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

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

b = A("b")
i = B("i")
j = C("j")
e = D("e")
a = D("a")
f = A("f")
g = A("g")
l = C("l")
n = D("n")
m = D("m")

b.y = g
b.v = l
b.s = i
b.p = i
i.t = m
i.z = f
j.v = l
j.o = l
j.t = n
e.r = g
e.o = b
a.r = g
a.o = b
f.y = b
f.v = l
f.s = i
f.p = i
g.y = b
g.v = l
g.s = i
g.p = i
l.v = j
l.o = j
l.t = m
n.r = f
n.o = g
m.r = g
m.o = b
assert j.v.t.o.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: C = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

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

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

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

b = A("b")
i = B("i")
j = C("j")
e = D("e")
a = D("a")
f = A("f")
g = A("g")
l = C("l")
n = D("n")
m = D("m")

b.y = g
b.v = l
b.s = i
b.p = i
i.t = m
i.z = f
j.v = l
j.o = l
j.t = n
e.r = g
e.o = b
a.r = g
a.o = b
f.y = b
f.v = l
f.s = i
f.p = i
g.y = b
g.v = l
g.s = i
g.p = i
l.v = j
l.o = j
l.t = m
n.r = f
n.o = g
m.r = g
m.o = b
assert j.v.t.o.y.v.txt == "l"