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

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

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

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

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

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

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

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

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

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

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