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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.o: E = None
        self.u: C = None
        self.p: D = None
        self.txt = txt

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

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

g = A("g")
m = B("m")
f = C("f")
i = D("i")
l = E("l")
b = C("b")
j = E("j")

g.o = l
g.z = f
m.u = f
f.x = i
f.p = i
f.v = b
f.u = b
f.o = j
i.s = j
i.q = g
i.o = g
i.t = l
l.o = g
b.x = i
b.p = i
b.v = f
b.u = f
b.o = j
j.o = g
assert j.o.z.x.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.o: E = None
        self.u: C = None
        self.p: D = None
        self.txt = txt

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

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

g = A("g")
m = B("m")
f = C("f")
i = D("i")
l = E("l")
b = C("b")
j = E("j")

g.o = l
g.z = f
m.u = f
f.x = i
f.p = i
f.v = b
f.u = b
f.o = j
i.s = j
i.q = g
i.o = g
i.t = l
l.o = g
b.x = i
b.p = i
b.v = f
b.u = f
b.o = j
j.o = g
assert j.o.z.x.s.o.txt == "g"