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

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

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

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

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

g = A("g")
j = B("j")
k = C("k")
a = D("a")
d = E("d")
b = E("b")

g.p = j
g.o = b
j.s = b
j.y = d
k.z = b
a.y = j
a.o = j
a.s = g
d.o = b
d.u = k
b.o = d
b.u = k
assert b.o.o.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: E = None
        self.txt = txt

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

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

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

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

g = A("g")
j = B("j")
k = C("k")
a = D("a")
d = E("d")
b = E("b")

g.p = j
g.o = b
j.s = b
j.y = d
k.z = b
a.y = j
a.o = j
a.s = g
d.o = b
d.u = k
b.o = d
b.u = k
assert b.o.o.u.z.txt == "b"