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

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

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

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

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

g.x = e
g.t = e
g.s = l
l.r = e
f.p = m
e.r = j
e.y = f
n.x = j
n.s = l
n.t = e
k.r = e
j.r = e
j.y = f
a.r = j
a.y = f
m.x = e
m.s = l
m.t = a
assert j.y.p.t.r.y.p.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

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

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

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

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

g.x = e
g.t = e
g.s = l
l.r = e
f.p = m
e.r = j
e.y = f
n.x = j
n.s = l
n.t = e
k.r = e
j.r = e
j.y = f
a.r = j
a.y = f
m.x = e
m.s = l
m.t = a
assert j.y.p.t.r.y.p.t.r.txt == "j"