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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: B = None
        self.p: D = None
        self.u: B = None
        self.txt = txt

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

j = A("j")
i = B("i")
n = C("n")
d = D("d")
e = A("e")
c = D("c")
b = C("b")
l = C("l")

j.w = e
j.s = b
j.t = l
j.q = i
i.q = n
n.v = i
n.y = i
n.u = i
n.p = d
d.o = i
d.x = i
d.y = l
e.w = j
e.s = l
e.t = b
e.q = i
c.o = i
c.x = i
c.y = n
b.v = i
b.y = i
b.u = i
b.p = c
l.v = i
l.y = i
l.u = i
l.p = d
assert c.o.q.p.o.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: C = None
        self.t: C = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: B = None
        self.p: D = None
        self.u: B = None
        self.txt = txt

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

j = A("j")
i = B("i")
n = C("n")
d = D("d")
e = A("e")
c = D("c")
b = C("b")
l = C("l")

j.w = e
j.s = b
j.t = l
j.q = i
i.q = n
n.v = i
n.y = i
n.u = i
n.p = d
d.o = i
d.x = i
d.y = l
e.w = j
e.s = l
e.t = b
e.q = i
c.o = i
c.x = i
c.y = n
b.v = i
b.y = i
b.u = i
b.p = c
l.v = i
l.y = i
l.u = i
l.p = d
assert c.o.q.p.o.q.p.txt == "d"