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

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

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

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

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

j.s = h
j.x = l
j.t = g
a.t = k
a.v = k
a.x = g
a.s = j
h.x = j
h.z = k
n.x = l
n.v = j
k.t = a
k.v = a
k.x = g
k.s = j
f.x = n
f.v = j
g.x = j
g.z = a
l.x = f
l.v = j
assert h.x.x.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

j.s = h
j.x = l
j.t = g
a.t = k
a.v = k
a.x = g
a.s = j
h.x = j
h.z = k
n.x = l
n.v = j
k.t = a
k.v = a
k.x = g
k.s = j
f.x = n
f.v = j
g.x = j
g.z = a
l.x = f
l.v = j
assert h.x.x.v.s.txt == "h"