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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

l = A("l")
b = B("b")
c = C("c")
k = D("k")
a = E("a")
g = C("g")
f = C("f")
m = A("m")
i = A("i")

l.y = f
l.w = a
b.p = a
c.x = l
k.v = m
a.p = k
a.u = g
a.x = b
a.z = b
g.x = m
f.x = m
m.y = f
m.w = a
i.y = f
i.w = a
assert b.p.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

l = A("l")
b = B("b")
c = C("c")
k = D("k")
a = E("a")
g = C("g")
f = C("f")
m = A("m")
i = A("i")

l.y = f
l.w = a
b.p = a
c.x = l
k.v = m
a.p = k
a.u = g
a.x = b
a.z = b
g.x = m
f.x = m
m.y = f
m.w = a
i.y = f
i.w = a
assert b.p.u.x.txt == "m"