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

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

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

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

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

c = A("c")
f = B("f")
k = C("k")
g = D("g")
j = E("j")
d = B("d")

c.y = j
c.q = j
c.w = g
c.r = g
f.u = g
k.x = g
k.w = j
g.w = c
g.v = c
g.u = k
j.r = g
j.w = d
j.x = c
j.q = k
d.u = g
assert c.w.w.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: E = None
        self.w: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

c = A("c")
f = B("f")
k = C("k")
g = D("g")
j = E("j")
d = B("d")

c.y = j
c.q = j
c.w = g
c.r = g
f.u = g
k.x = g
k.w = j
g.w = c
g.v = c
g.u = k
j.r = g
j.w = d
j.x = c
j.q = k
d.u = g
assert c.w.w.q.r.txt == "g"