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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

c.p = m
c.v = j
c.w = i
b.q = m
b.s = l
b.y = k
i.p = k
i.v = c
l.x = f
f.w = c
f.x = e
g.x = e
m.x = f
e.w = c
e.x = f
j.x = f
k.q = l
k.s = j
k.y = b
assert l.x.w.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: D = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

c.p = m
c.v = j
c.w = i
b.q = m
b.s = l
b.y = k
i.p = k
i.v = c
l.x = f
f.w = c
f.x = e
g.x = e
m.x = f
e.w = c
e.x = f
j.x = f
k.q = l
k.s = j
k.y = b
assert l.x.w.v.x.txt == "f"