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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: A = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
a = C("a")
g = D("g")
j = D("j")
d = D("d")
m = A("m")
f = C("f")

i.y = g
i.o = m
i.r = m
i.t = m
k.x = m
k.y = m
k.w = g
k.q = a
a.w = m
a.q = k
a.t = f
g.o = k
g.r = m
g.s = i
j.o = k
j.r = i
j.s = m
d.o = k
d.r = m
d.s = m
m.y = d
m.o = i
m.r = i
m.t = i
f.w = m
f.q = k
f.t = a
assert j.s.t.y.o.y.y.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: A = None
        self.r: A = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: A = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
a = C("a")
g = D("g")
j = D("j")
d = D("d")
m = A("m")
f = C("f")

i.y = g
i.o = m
i.r = m
i.t = m
k.x = m
k.y = m
k.w = g
k.q = a
a.w = m
a.q = k
a.t = f
g.o = k
g.r = m
g.s = i
j.o = k
j.r = i
j.s = m
d.o = k
d.r = m
d.s = m
m.y = d
m.o = i
m.r = i
m.t = i
f.w = m
f.q = k
f.t = a
assert j.s.t.y.o.y.y.o.w.txt == "g"