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

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

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

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

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

g.v = f
g.w = f
g.t = n
n.p = i
l.u = n
l.x = d
l.w = i
d.q = n
d.o = i
d.s = e
f.q = n
f.o = i
f.s = e
e.q = n
e.o = i
e.s = d
i.v = e
i.t = n
i.w = f
assert f.o.w.s.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

g.v = f
g.w = f
g.t = n
n.p = i
l.u = n
l.x = d
l.w = i
d.q = n
d.o = i
d.s = e
f.q = n
f.o = i
f.s = e
e.q = n
e.o = i
e.s = d
i.v = e
i.t = n
i.w = f
assert f.o.w.s.s.s.q.txt == "n"