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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

i = A("i")
d = B("d")
n = C("n")
b = D("b")
h = E("h")
c = C("c")
g = E("g")
e = A("e")

i.y = b
i.z = b
d.x = h
n.p = d
b.r = d
b.w = d
b.x = d
b.v = c
b.q = e
h.y = i
h.w = d
c.p = d
g.y = i
g.w = d
e.y = b
e.z = b
assert e.y.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

i = A("i")
d = B("d")
n = C("n")
b = D("b")
h = E("h")
c = C("c")
g = E("g")
e = A("e")

i.y = b
i.z = b
d.x = h
n.p = d
b.r = d
b.w = d
b.x = d
b.v = c
b.q = e
h.y = i
h.w = d
c.p = d
g.y = i
g.w = d
e.y = b
e.z = b
assert e.y.w.x.y.txt == "i"