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

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

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

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

j = A("j")
e = B("e")
k = C("k")
l = D("l")
d = A("d")
f = C("f")
b = A("b")
a = C("a")
g = A("g")

j.r = d
j.y = d
j.s = d
e.s = l
k.t = a
k.s = e
l.s = k
d.r = g
d.s = g
d.y = j
f.t = a
f.s = e
b.r = g
b.y = d
b.s = d
a.t = k
a.s = e
g.r = b
g.y = d
g.s = j
assert l.s.t.t.t.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: A = None
        self.s: A = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
k = C("k")
l = D("l")
d = A("d")
f = C("f")
b = A("b")
a = C("a")
g = A("g")

j.r = d
j.y = d
j.s = d
e.s = l
k.t = a
k.s = e
l.s = k
d.r = g
d.s = g
d.y = j
f.t = a
f.s = e
b.r = g
b.y = d
b.s = d
a.t = k
a.s = e
g.r = b
g.y = d
g.s = j
assert l.s.t.t.t.t.s.txt == "e"