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

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

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

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

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

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

g.r = j
g.w = c
l.u = j
l.z = c
l.p = c
j.z = c
j.u = e
j.o = g
d.q = j
d.p = j
d.w = e
d.r = e
d.u = g
e.r = i
c.u = b
c.z = l
c.p = l
i.q = b
i.p = b
i.w = e
i.r = e
i.u = g
b.z = c
b.u = e
b.o = g
assert i.p.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

g.r = j
g.w = c
l.u = j
l.z = c
l.p = c
j.z = c
j.u = e
j.o = g
d.q = j
d.p = j
d.w = e
d.r = e
d.u = g
e.r = i
c.u = b
c.z = l
c.p = l
i.q = b
i.p = b
i.w = e
i.r = e
i.u = g
b.z = c
b.u = e
b.o = g
assert i.p.z.u.z.txt == "c"