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

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

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

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

j = A("j")
d = B("d")
a = C("a")
i = D("i")
b = A("b")
c = C("c")
h = D("h")
k = D("k")
f = D("f")

j.s = d
j.r = b
d.o = a
d.v = a
d.w = j
d.s = f
a.p = c
a.o = k
i.q = d
i.t = h
i.v = k
b.s = d
b.r = j
c.p = a
c.o = i
h.q = d
h.t = k
h.v = f
k.q = d
k.t = h
k.v = f
f.q = d
f.t = k
f.v = h
assert a.p.o.v.t.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: A = None
        self.txt = txt

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

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

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

j = A("j")
d = B("d")
a = C("a")
i = D("i")
b = A("b")
c = C("c")
h = D("h")
k = D("k")
f = D("f")

j.s = d
j.r = b
d.o = a
d.v = a
d.w = j
d.s = f
a.p = c
a.o = k
i.q = d
i.t = h
i.v = k
b.s = d
b.r = j
c.p = a
c.o = i
h.q = d
h.t = k
h.v = f
k.q = d
k.t = h
k.v = f
f.q = d
f.t = k
f.v = h
assert a.p.o.v.t.q.w.txt == "j"