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

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

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

e = A("e")
d = B("d")
n = C("n")
k = A("k")
h = A("h")
f = B("f")
j = A("j")

e.r = f
e.o = n
d.w = h
d.u = n
d.s = n
n.p = j
n.z = h
k.r = f
k.o = n
h.r = f
h.o = n
f.w = k
f.u = n
f.s = n
j.r = d
j.o = n
assert j.r.w.r.s.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
n = C("n")
k = A("k")
h = A("h")
f = B("f")
j = A("j")

e.r = f
e.o = n
d.w = h
d.u = n
d.s = n
n.p = j
n.z = h
k.r = f
k.o = n
h.r = f
h.o = n
f.w = k
f.u = n
f.s = n
j.r = d
j.o = n
assert j.r.w.r.s.p.o.txt == "n"