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

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

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

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

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

b = A("b")
e = B("e")
g = C("g")
k = D("k")
m = E("m")
i = C("i")
f = A("f")
a = E("a")

b.w = i
e.p = m
e.q = i
e.w = a
g.y = b
k.x = a
k.p = f
m.p = e
m.t = f
i.y = b
f.w = i
a.p = e
a.t = f
assert b.w.y.w.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

b = A("b")
e = B("e")
g = C("g")
k = D("k")
m = E("m")
i = C("i")
f = A("f")
a = E("a")

b.w = i
e.p = m
e.q = i
e.w = a
g.y = b
k.x = a
k.p = f
m.p = e
m.t = f
i.y = b
f.w = i
a.p = e
a.t = f
assert b.w.y.w.y.w.y.txt == "b"