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

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

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

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

i = A("i")
k = B("k")
n = C("n")
l = D("l")
e = A("e")
g = D("g")
h = A("h")
f = A("f")
j = B("j")

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

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

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

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

i = A("i")
k = B("k")
n = C("n")
l = D("l")
e = A("e")
g = D("g")
h = A("h")
f = A("f")
j = B("j")

i.x = j
i.r = n
k.s = g
k.x = j
k.p = j
k.r = i
n.v = h
n.o = e
l.t = n
l.p = k
l.z = k
l.w = h
e.x = k
e.r = n
g.t = n
g.p = j
g.z = k
g.w = e
h.x = j
h.r = n
f.x = j
f.r = n
j.s = l
j.x = k
j.p = k
j.r = e
assert l.w.x.s.t.o.r.v.x.txt == "j"