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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.w: A = None
        self.z: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: E = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
a = C("a")
i = D("i")
h = E("h")
j = B("j")
l = D("l")

c.z = h
c.w = l
d.o = i
d.t = j
d.z = j
d.w = c
a.t = h
a.v = h
i.x = c
h.p = c
j.o = i
j.t = d
j.z = d
j.w = c
l.x = c
assert h.p.z.p.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.w: A = None
        self.z: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: E = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
a = C("a")
i = D("i")
h = E("h")
j = B("j")
l = D("l")

c.z = h
c.w = l
d.o = i
d.t = j
d.z = j
d.w = c
a.t = h
a.v = h
i.x = c
h.p = c
j.o = i
j.t = d
j.z = d
j.w = c
l.x = c
assert h.p.z.p.w.x.txt == "c"