class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: E = None
        self.w: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

f.q = b
f.r = i
f.w = g
f.y = c
k.r = i
k.v = i
k.y = f
n.o = m
n.p = b
n.u = k
c.u = n
c.r = n
c.t = i
c.o = i
i.r = g
i.z = g
i.v = f
i.s = m
i.o = k
m.o = n
m.p = k
m.u = b
g.u = n
g.r = n
g.t = i
g.o = i
b.r = i
b.v = i
b.y = f
assert m.p.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: E = None
        self.w: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

f.q = b
f.r = i
f.w = g
f.y = c
k.r = i
k.v = i
k.y = f
n.o = m
n.p = b
n.u = k
c.u = n
c.r = n
c.t = i
c.o = i
i.r = g
i.z = g
i.v = f
i.s = m
i.o = k
m.o = n
m.p = k
m.u = b
g.u = n
g.r = n
g.t = i
g.o = i
b.r = i
b.v = i
b.y = f
assert m.p.y.r.txt == "i"