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

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

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

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

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

e.o = n
e.p = l
l.t = j
l.s = g
l.w = e
j.y = m
j.p = g
j.z = n
m.p = n
n.p = m
g.t = j
g.s = l
g.w = e
assert n.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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

e.o = n
e.p = l
l.t = j
l.s = g
l.w = e
j.y = m
j.p = g
j.z = n
m.p = n
n.p = m
g.t = j
g.s = l
g.w = e
assert n.p.p.p.p.txt == "n"