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

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

d = A("d")
g = B("g")
b = B("b")
m = B("m")
k = B("k")
h = A("h")
i = B("i")
l = A("l")
e = A("e")
n = A("n")

d.x = n
d.t = h
g.s = n
g.y = l
b.s = l
b.y = e
m.s = l
m.y = d
k.s = l
k.y = l
h.x = l
h.t = e
i.s = l
i.y = n
l.x = n
l.t = n
e.x = n
e.t = d
n.x = h
n.t = l
assert d.x.t.x.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: A = None
        self.txt = txt

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

d = A("d")
g = B("g")
b = B("b")
m = B("m")
k = B("k")
h = A("h")
i = B("i")
l = A("l")
e = A("e")
n = A("n")

d.x = n
d.t = h
g.s = n
g.y = l
b.s = l
b.y = e
m.s = l
m.y = d
k.s = l
k.y = l
h.x = l
h.t = e
i.s = l
i.y = n
l.x = n
l.t = n
e.x = n
e.t = d
n.x = h
n.t = l
assert d.x.t.x.t.x.txt == "n"