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

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

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

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

j = A("j")
i = B("i")
g = C("g")
k = D("k")
l = D("l")
m = B("m")
a = D("a")
n = B("n")
h = A("h")
d = D("d")

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

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

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

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

j = A("j")
i = B("i")
g = C("g")
k = D("k")
l = D("l")
m = B("m")
a = D("a")
n = B("n")
h = A("h")
d = D("d")

j.t = g
i.x = g
g.s = d
k.s = h
k.v = a
l.s = j
l.v = k
m.x = g
a.s = h
a.v = l
n.x = g
h.t = g
d.s = h
d.v = a
assert h.t.s.s.t.txt == "g"