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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: B = None
        self.txt = txt

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

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

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