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

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

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

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

j = A("j")
e = B("e")
a = C("a")
l = D("l")
d = D("d")
m = D("m")
i = C("i")
n = A("n")
g = D("g")
b = B("b")

j.r = e
j.w = n
j.p = i
e.z = b
e.y = g
a.x = i
l.v = b
l.o = j
l.w = j
d.v = e
d.o = j
d.w = j
m.v = b
m.o = j
m.w = n
i.x = a
n.r = e
n.w = j
n.p = a
g.v = e
g.o = j
g.w = j
b.z = e
b.y = l
assert n.r.y.w.p.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: A = None
        self.p: C = None
        self.txt = txt

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

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

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

j = A("j")
e = B("e")
a = C("a")
l = D("l")
d = D("d")
m = D("m")
i = C("i")
n = A("n")
g = D("g")
b = B("b")

j.r = e
j.w = n
j.p = i
e.z = b
e.y = g
a.x = i
l.v = b
l.o = j
l.w = j
d.v = e
d.o = j
d.w = j
m.v = b
m.o = j
m.w = n
i.x = a
n.r = e
n.w = j
n.p = a
g.v = e
g.o = j
g.w = j
b.z = e
b.y = l
assert n.r.y.w.p.x.x.x.x.x.x.txt == "i"