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

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

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

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

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

d = A("d")
c = B("c")
a = C("a")
k = D("k")
g = E("g")
b = A("b")

d.w = g
d.y = b
d.u = c
c.y = d
a.u = c
k.o = c
k.q = g
k.p = d
g.o = d
g.w = d
g.t = c
g.p = a
g.x = k
b.w = g
b.y = d
b.u = c
assert g.p.u.y.u.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: A = None
        self.u: B = None
        self.txt = txt

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

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

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

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

d = A("d")
c = B("c")
a = C("a")
k = D("k")
g = E("g")
b = A("b")

d.w = g
d.y = b
d.u = c
c.y = d
a.u = c
k.o = c
k.q = g
k.p = d
g.o = d
g.w = d
g.t = c
g.p = a
g.x = k
b.w = g
b.y = d
b.u = c
assert g.p.u.y.u.y.y.txt == "b"