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

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

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

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

f = A("f")
e = B("e")
n = C("n")
m = D("m")
k = A("k")
c = D("c")
j = B("j")

f.o = c
f.s = m
e.v = k
e.q = j
e.p = j
e.s = n
n.p = f
n.z = m
m.v = c
m.u = n
k.o = m
k.s = m
c.v = m
c.u = n
j.v = f
j.q = e
j.p = e
j.s = n
assert e.v.s.v.u.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: D = None
        self.txt = txt

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

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

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

f = A("f")
e = B("e")
n = C("n")
m = D("m")
k = A("k")
c = D("c")
j = B("j")

f.o = c
f.s = m
e.v = k
e.q = j
e.p = j
e.s = n
n.p = f
n.z = m
m.v = c
m.u = n
k.o = m
k.s = m
c.v = m
c.u = n
j.v = f
j.q = e
j.p = e
j.s = n
assert e.v.s.v.u.p.s.txt == "m"