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

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

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

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

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

g.w = k
g.p = a
g.q = a
d.y = n
k.v = g
k.o = l
k.p = a
k.s = j
l.x = k
l.s = a
n.y = d
j.w = a
j.p = a
j.q = a
a.v = g
a.s = g
a.o = l
a.p = k
assert n.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

g.w = k
g.p = a
g.q = a
d.y = n
k.v = g
k.o = l
k.p = a
k.s = j
l.x = k
l.s = a
n.y = d
j.w = a
j.p = a
j.q = a
a.v = g
a.s = g
a.o = l
a.p = k
assert n.y.y.y.y.y.txt == "d"