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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: E = None
        self.z: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.o: E = None
        self.t: B = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: C = None
        self.txt = txt

g = A("g")
e = B("e")
a = C("a")
j = D("j")
f = E("f")
d = B("d")
h = A("h")
n = B("n")

g.o = j
g.r = f
e.t = n
e.o = f
e.z = d
a.y = e
j.z = h
j.p = d
j.o = f
j.t = e
j.r = a
f.s = a
f.r = a
d.t = n
d.z = n
d.o = f
h.o = j
h.r = f
n.t = e
n.o = f
n.z = d
assert a.y.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: E = None
        self.z: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.o: E = None
        self.t: B = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: C = None
        self.txt = txt

g = A("g")
e = B("e")
a = C("a")
j = D("j")
f = E("f")
d = B("d")
h = A("h")
n = B("n")

g.o = j
g.r = f
e.t = n
e.o = f
e.z = d
a.y = e
j.z = h
j.p = d
j.o = f
j.t = e
j.r = a
f.s = a
f.r = a
d.t = n
d.z = n
d.o = f
h.o = j
h.r = f
n.t = e
n.o = f
n.z = d
assert a.y.z.t.txt == "n"