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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

j = A("j")
h = B("h")
l = C("l")
m = D("m")
a = E("a")
n = B("n")

j.z = n
j.o = l
h.t = l
l.y = j
l.s = j
l.x = n
l.r = n
l.p = h
m.t = j
m.p = j
m.q = a
m.o = h
m.s = h
a.v = n
n.t = l
assert j.o.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

j = A("j")
h = B("h")
l = C("l")
m = D("m")
a = E("a")
n = B("n")

j.z = n
j.o = l
h.t = l
l.y = j
l.s = j
l.x = n
l.r = n
l.p = h
m.t = j
m.p = j
m.q = a
m.o = h
m.s = h
a.v = n
n.t = l
assert j.o.y.o.txt == "l"