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

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: A = None
        self.v: B = None
        self.z: E = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: C = None
        self.t: B = None
        self.y: A = None
        self.z: B = None
        self.txt = txt

j = A("j")
f = B("f")
c = C("c")
b = D("b")
d = E("d")
n = B("n")
g = D("g")
l = A("l")

j.y = b
j.t = b
j.q = l
j.r = c
j.s = c
f.q = n
f.p = g
c.x = b
c.v = j
b.t = g
b.q = j
b.v = n
b.w = n
b.z = d
d.s = f
d.t = f
d.z = f
d.r = c
d.y = j
n.q = f
n.p = b
g.t = b
g.q = l
g.v = f
g.z = d
g.w = n
l.y = b
l.q = j
l.r = c
l.s = c
l.t = g
assert d.t.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: A = None
        self.r: C = None
        self.t: D = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: A = None
        self.v: B = None
        self.z: E = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: C = None
        self.t: B = None
        self.y: A = None
        self.z: B = None
        self.txt = txt

j = A("j")
f = B("f")
c = C("c")
b = D("b")
d = E("d")
n = B("n")
g = D("g")
l = A("l")

j.y = b
j.t = b
j.q = l
j.r = c
j.s = c
f.q = n
f.p = g
c.x = b
c.v = j
b.t = g
b.q = j
b.v = n
b.w = n
b.z = d
d.s = f
d.t = f
d.z = f
d.r = c
d.y = j
n.q = f
n.p = b
g.t = b
g.q = l
g.v = f
g.z = d
g.w = n
l.y = b
l.q = j
l.r = c
l.s = c
l.t = g
assert d.t.p.v.txt == "f"