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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: C = None
        self.r: C = None
        self.t: C = None
        self.x: A = None
        self.txt = txt

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

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

l.u = i
g.r = i
g.u = i
g.v = m
g.z = f
f.s = c
f.p = c
i.y = l
i.x = l
i.v = f
i.r = f
i.t = f
k.p = i
k.u = f
c.p = i
c.u = f
m.p = i
m.u = f
j.u = i
assert f.s.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: C = None
        self.r: C = None
        self.t: C = None
        self.x: A = None
        self.txt = txt

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

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

l.u = i
g.r = i
g.u = i
g.v = m
g.z = f
f.s = c
f.p = c
i.y = l
i.x = l
i.v = f
i.r = f
i.t = f
k.p = i
k.u = f
c.p = i
c.u = f
m.p = i
m.u = f
j.u = i
assert f.s.p.x.txt == "l"